java110 4 lat temu
rodzic
commit
350221422c

+ 4 - 1
java110-bean/src/main/java/com/java110/dto/machine/CarInoutDetailDto.java

@@ -13,7 +13,7 @@ import java.util.Date;
  * @Version 1.0
  * add by wuxw 2019/4/24
  **/
-public class CarInoutDetailDto extends PageDto implements Serializable {
+public class CarInoutDetailDto extends CarInoutDto implements Serializable {
 
     public static final String CAR_INOUT_IN = "3306";
     public static final String CAR_INOUT_OUT = "3307";
@@ -27,6 +27,7 @@ public class CarInoutDetailDto extends PageDto implements Serializable {
     private String communityId;
 
 
+
     private Date createTime;
 
     private String statusCd = "0";
@@ -104,4 +105,6 @@ public class CarInoutDetailDto extends PageDto implements Serializable {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
     }
+
+
 }

+ 8 - 0
java110-core/src/main/java/com/java110/core/smo/IComputeFeeSMO.java

@@ -2,6 +2,7 @@ package com.java110.core.smo;
 
 import com.java110.dto.RoomDto;
 import com.java110.dto.fee.FeeDto;
+import com.java110.dto.machine.CarInoutDetailDto;
 import com.java110.dto.machine.CarInoutDto;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
@@ -150,4 +151,11 @@ public interface IComputeFeeSMO {
      * @param carInoutDtos
      */
     List<CarInoutDto> computeTempCarStopTimeAndFee(List<CarInoutDto> carInoutDtos);
+
+    /**
+     * 计算停车时间和费用
+     *
+     * @param carInoutDtos
+     */
+    List<CarInoutDetailDto> computeTempCarInoutDetailStopTimeAndFee(List<CarInoutDetailDto> carInoutDtos);
 }

+ 13 - 0
java110-core/src/main/java/com/java110/core/smo/impl/ComputeFeeSMOImpl.java

@@ -10,6 +10,7 @@ import com.java110.dto.fee.BillOweFeeDto;
 import com.java110.dto.fee.FeeAttrDto;
 import com.java110.dto.fee.FeeConfigDto;
 import com.java110.dto.fee.FeeDto;
+import com.java110.dto.machine.CarInoutDetailDto;
 import com.java110.dto.machine.CarInoutDto;
 import com.java110.dto.owner.OwnerCarDto;
 import com.java110.dto.owner.OwnerDto;
@@ -1562,6 +1563,18 @@ public class ComputeFeeSMOImpl implements IComputeFeeSMO {
 
     }
 
+    @Override
+    public List<CarInoutDetailDto> computeTempCarInoutDetailStopTimeAndFee(List<CarInoutDetailDto> carInoutDtos) {
+        if (carInoutDtos == null || carInoutDtos.size() < 1) {
+            return null;
+        }
+
+
+        carInoutDtos = tempCarFeeConfigInnerServiceSMOImpl.computeTempCarInoutDetailFee(carInoutDtos);
+
+        return carInoutDtos;
+    }
+
 
     public static void main(String[] args) {
         ComputeFeeSMOImpl computeFeeSMO = new ComputeFeeSMOImpl();

+ 7 - 2
java110-db/src/main/resources/mapper/common/CarInoutDetailV1ServiceDaoImplMapper.xml

@@ -19,8 +19,11 @@
     <select id="getCarInoutDetailInfo" parameterType="Map" resultType="Map">
         select t.inout_id,t.inout_id inoutId,t.machine_id,t.machine_id machineId,t.machine_code,t.machine_code
         machineCode,t.car_inout,t.car_inout carInout,t.pa_id,t.pa_id paId,t.detail_id,t.detail_id
-        detailId,t.car_num,t.car_num carNum,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId
+        detailId,t.car_num,t.car_num carNum,t.status_cd,t.status_cd statusCd,t.community_id,t.community_id communityId,
+        ci.in_time inTime,ci.out_time outTime,cip.real_charge realCharge,ci.pa_id paId
         from car_inout_detail t
+        left join car_inout ci on t.inout_id = ci.inout_id and ci.status_cd = '0' and t.community_id = ci.community_id
+        left join car_inout_payment cip on cip.inout_id = ci.inout_id and cip.community_id = ci.community_id
         where 1 =1
         <if test="inoutId !=null and inoutId != ''">
             and t.inout_id= #{inoutId}
@@ -95,7 +98,9 @@
     <select id="queryCarInoutDetailsCount" parameterType="Map" resultType="Map">
         select count(1) count
         from car_inout_detail t
-        where 1 =1
+        left join car_inout ci on t.inout_id = ci.inout_id and ci.status_cd = '0' and t.community_id = ci.community_id
+        left join car_inout_payment cip on cip.inout_id = ci.inout_id and cip.community_id = ci.community_id
+        where 1 = 1
         <if test="inoutId !=null and inoutId != ''">
             and t.inout_id= #{inoutId}
         </if>

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/fee/ITempCarFeeConfigInnerServiceSMO.java

@@ -1,6 +1,7 @@
 package com.java110.intf.fee;
 
 import com.java110.config.feign.FeignConfiguration;
+import com.java110.dto.machine.CarInoutDetailDto;
 import com.java110.dto.machine.CarInoutDto;
 import com.java110.dto.tempCarFeeConfig.TempCarFeeConfigDto;
 import com.java110.dto.tempCarFeeConfig.TempCarFeeRuleDto;
@@ -58,4 +59,7 @@ public interface ITempCarFeeConfigInnerServiceSMO {
      */
     @RequestMapping(value = "/computeTempCarFee", method = RequestMethod.POST)
     List<CarInoutDto> computeTempCarFee(@RequestBody List<CarInoutDto> carInoutDtos);
+
+    @RequestMapping(value = "/computeTempCarInoutDetailFee", method = RequestMethod.POST)
+    List<CarInoutDetailDto> computeTempCarInoutDetailFee(@RequestBody List<CarInoutDetailDto> carInoutDtos);
 }

+ 0 - 71
service-common/src/main/java/com/java110/common/cmd/carInoutDetail/DeleteCarInoutDetailCmd.java

@@ -1,71 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.common.cmd.carInoutDetail;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.AbstractServiceCmdListener;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.intf.common.ICarInoutDetailV1InnerServiceSMO;
-import com.java110.po.car.CarInoutDetailPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-/**
- * 类表述:删除
- * 服务编码:carInoutDetail.deleteCarInoutDetail
- * 请求路劲:/app/carInoutDetail.DeleteCarInoutDetail
- * add by 吴学文 at 2021-10-13 16:12:25 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "carInoutDetail.deleteCarInoutDetail")
-public class DeleteCarInoutDetailCmd extends AbstractServiceCmdListener {
-  private static Logger logger = LoggerFactory.getLogger(DeleteCarInoutDetailCmd.class);
-
-    @Autowired
-    private ICarInoutDetailV1InnerServiceSMO carInoutDetailV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "detailId", "detailId不能为空");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-       CarInoutDetailPo carInoutDetailPo = BeanConvertUtil.covertBean(reqJson, CarInoutDetailPo.class);
-        int flag = carInoutDetailV1InnerServiceSMOImpl.deleteCarInoutDetail(carInoutDetailPo);
-
-        if (flag < 1) {
-            throw new CmdException("删除数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}

+ 10 - 0
service-common/src/main/java/com/java110/common/cmd/carInoutDetail/ListCarInoutDetailCmd.java

@@ -20,6 +20,7 @@ import com.java110.core.annotation.Java110Cmd;
 import com.java110.core.context.ICmdDataFlowContext;
 import com.java110.core.event.cmd.AbstractServiceCmdListener;
 import com.java110.core.event.cmd.CmdEvent;
+import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.machine.CarInoutDetailDto;
 import com.java110.intf.common.ICarInoutDetailV1InnerServiceSMO;
 import com.java110.utils.exception.CmdException;
@@ -52,6 +53,9 @@ public class ListCarInoutDetailCmd extends AbstractServiceCmdListener {
     @Autowired
     private ICarInoutDetailV1InnerServiceSMO carInoutDetailV1InnerServiceSMOImpl;
 
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
@@ -68,6 +72,7 @@ public class ListCarInoutDetailCmd extends AbstractServiceCmdListener {
 
         if (count > 0) {
             carInoutDetailDtos = carInoutDetailV1InnerServiceSMOImpl.queryCarInoutDetails(carInoutDetailDto);
+            carInoutDetailDtos = computeCarInoutDetail(carInoutDetailDtos);
         } else {
             carInoutDetailDtos = new ArrayList<>();
         }
@@ -78,4 +83,9 @@ public class ListCarInoutDetailCmd extends AbstractServiceCmdListener {
 
         cmdDataFlowContext.setResponseEntity(responseEntity);
     }
+
+
+    private List<CarInoutDetailDto> computeCarInoutDetail(List<CarInoutDetailDto> carInoutDetailDtos) {
+        return computeFeeSMOImpl.computeTempCarInoutDetailStopTimeAndFee(carInoutDetailDtos);
+    }
 }

+ 0 - 80
service-common/src/main/java/com/java110/common/cmd/carInoutDetail/SaveCarInoutDetailCmd.java

@@ -1,80 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.common.cmd.carInoutDetail;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.AbstractServiceCmdListener;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.intf.common.ICarInoutDetailV1InnerServiceSMO;
-import com.java110.po.car.CarInoutDetailPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * 类表述:保存
- * 服务编码:carInoutDetail.saveCarInoutDetail
- * 请求路劲:/app/carInoutDetail.SaveCarInoutDetail
- * add by 吴学文 at 2021-10-13 16:12:25 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "carInoutDetail.saveCarInoutDetail")
-public class SaveCarInoutDetailCmd extends AbstractServiceCmdListener {
-
-    private static Logger logger = LoggerFactory.getLogger(SaveCarInoutDetailCmd.class);
-
-    public static final String CODE_PREFIX_ID = "10";
-
-    @Autowired
-    private ICarInoutDetailV1InnerServiceSMO carInoutDetailV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "inoutId", "请求报文中未包含inoutId");
-Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含communityId");
-Assert.hasKeyAndValue(reqJson, "machineId", "请求报文中未包含machineId");
-Assert.hasKeyAndValue(reqJson, "machineCode", "请求报文中未包含machineCode");
-Assert.hasKeyAndValue(reqJson, "carNum", "请求报文中未包含carNum");
-Assert.hasKeyAndValue(reqJson, "paId", "请求报文中未包含paId");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-       CarInoutDetailPo carInoutDetailPo = BeanConvertUtil.covertBean(reqJson, CarInoutDetailPo.class);
-        carInoutDetailPo.setDetailId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID));
-        int flag = carInoutDetailV1InnerServiceSMOImpl.saveCarInoutDetail(carInoutDetailPo);
-
-        if (flag < 1) {
-            throw new CmdException("保存数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}

+ 0 - 75
service-common/src/main/java/com/java110/common/cmd/carInoutDetail/UpdateCarInoutDetailCmd.java

@@ -1,75 +0,0 @@
-/*
- * Copyright 2017-2020 吴学文 and java110 team.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.java110.common.cmd.carInoutDetail;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.annotation.Java110Cmd;
-import com.java110.core.annotation.Java110Transactional;
-import com.java110.core.context.ICmdDataFlowContext;
-import com.java110.core.event.cmd.AbstractServiceCmdListener;
-import com.java110.core.event.cmd.CmdEvent;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.intf.common.ICarInoutDetailV1InnerServiceSMO;
-import com.java110.po.car.CarInoutDetailPo;
-import com.java110.utils.exception.CmdException;
-import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.vo.ResultVo;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-/**
- * 类表述:更新
- * 服务编码:carInoutDetail.updateCarInoutDetail
- * 请求路劲:/app/carInoutDetail.UpdateCarInoutDetail
- * add by 吴学文 at 2021-10-13 16:12:25 mail: 928255095@qq.com
- * open source address: https://gitee.com/wuxw7/MicroCommunity
- * 官网:http://www.homecommunity.cn
- * 温馨提示:如果您对此文件进行修改 请不要删除原有作者及注释信息,请补充您的 修改的原因以及联系邮箱如下
- * // modify by 张三 at 2021-09-12 第10行在某种场景下存在某种bug 需要修复,注释10至20行 加入 20行至30行
- */
-@Java110Cmd(serviceCode = "carInoutDetail.updateCarInoutDetail")
-public class UpdateCarInoutDetailCmd extends AbstractServiceCmdListener {
-
-  private static Logger logger = LoggerFactory.getLogger(UpdateCarInoutDetailCmd.class);
-
-
-    @Autowired
-    private ICarInoutDetailV1InnerServiceSMO carInoutDetailV1InnerServiceSMOImpl;
-
-    @Override
-    public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) {
-        Assert.hasKeyAndValue(reqJson, "detailId", "detailId不能为空");
-Assert.hasKeyAndValue(reqJson, "communityId", "communityId不能为空");
-
-    }
-
-    @Override
-    @Java110Transactional
-    public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
-
-       CarInoutDetailPo carInoutDetailPo = BeanConvertUtil.covertBean(reqJson, CarInoutDetailPo.class);
-        int flag = carInoutDetailV1InnerServiceSMOImpl.updateCarInoutDetail(carInoutDetailPo);
-
-        if (flag < 1) {
-            throw new CmdException("更新数据失败");
-        }
-
-        cmdDataFlowContext.setResponseEntity(ResultVo.success());
-    }
-}

+ 45 - 0
service-fee/src/main/java/com/java110/fee/smo/impl/TempCarFeeConfigInnerServiceSMOImpl.java

@@ -4,6 +4,7 @@ package com.java110.fee.smo.impl;
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.fee.TempCarFeeResult;
+import com.java110.dto.machine.CarInoutDetailDto;
 import com.java110.dto.machine.CarInoutDto;
 import com.java110.dto.tempCarFeeConfig.TempCarFeeConfigAttrDto;
 import com.java110.dto.tempCarFeeConfig.TempCarFeeConfigDto;
@@ -15,6 +16,7 @@ import com.java110.intf.fee.ITempCarFeeConfigAttrInnerServiceSMO;
 import com.java110.intf.fee.ITempCarFeeConfigInnerServiceSMO;
 import com.java110.utils.factory.ApplicationContextFactory;
 import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -22,6 +24,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -138,6 +141,48 @@ public class TempCarFeeConfigInnerServiceSMOImpl extends BaseServiceSMO implemen
         return carInoutDtos;
     }
 
+    @Override
+    public List<CarInoutDetailDto> computeTempCarInoutDetailFee(List<CarInoutDetailDto> carInoutDtos) {
+        TempCarFeeConfigDto tempCarFeeConfigDto = new TempCarFeeConfigDto();
+        tempCarFeeConfigDto.setPaId(carInoutDtos.get(0).getPaId());
+        tempCarFeeConfigDto.setCommunityId(carInoutDtos.get(0).getCommunityId());
+        List<TempCarFeeConfigDto> tempCarFeeConfigDtos = queryTempCarFeeConfigs(tempCarFeeConfigDto);
+
+        if (tempCarFeeConfigDtos == null || tempCarFeeConfigDtos.size() < 1) {
+            return carInoutDtos;
+        }
+        TempCarFeeConfigAttrDto tempCarFeeConfigAttrDto = new TempCarFeeConfigAttrDto();
+        tempCarFeeConfigAttrDto.setConfigId(tempCarFeeConfigDto.getConfigId());
+        tempCarFeeConfigAttrDto.setCommunityId(tempCarFeeConfigDto.getCommunityId());
+
+        List<TempCarFeeConfigAttrDto> tempCarFeeConfigAttrDtos = tempCarFeeConfigAttrInnerServiceSMOImpl.queryTempCarFeeConfigAttrs(tempCarFeeConfigAttrDto);
+        IComputeTempCarFee computeTempCarFee = ApplicationContextFactory.getBean(tempCarFeeConfigDtos.get(0).getRuleId(), IComputeTempCarFee.class);
+        for (CarInoutDetailDto carInoutDto : carInoutDtos) {
+            try {
+                if (CarInoutDetailDto.CAR_INOUT_IN.equals(carInoutDto.getCarInout())) {
+                    TempCarFeeResult result = computeTempCarFee.computeTempCarFee(carInoutDto, tempCarFeeConfigDtos.get(0), tempCarFeeConfigAttrDtos);
+                    carInoutDto.setMin(result.getMin());
+                    carInoutDto.setHours(result.getHours());
+                    carInoutDto.setPayCharge(result.getPayCharge() + "");
+                } else {
+                    //获取停车时间
+                    Date stateDate = DateUtil.getDateFromString(carInoutDto.getInTime(), DateUtil.DATE_FORMATE_STRING_A);
+                    Date endDate = DateUtil.getDateFromString(carInoutDto.getOutTime(), DateUtil.DATE_FORMATE_STRING_A);
+                    long min = (endDate.getTime() - stateDate.getTime()) / (60 * 1000);
+                    long hours = min / 60; //因为两者都是整数,你得到一个int
+                    long minutes = min % 60;
+                    carInoutDto.setMin(minutes);
+                    carInoutDto.setHours(hours);
+                    carInoutDto.setPayCharge(carInoutDto.getRealCharge());
+                }
+            } catch (Exception e) {
+                logger.error("临时车算费失败", e);
+            }
+        }
+
+        return carInoutDtos;
+    }
+
     private void freshRuleSpecs(List<TempCarFeeRuleDto> tempCarFeeRuleDtos) {
         if (tempCarFeeRuleDtos == null || tempCarFeeRuleDtos.size() < 1) {
             return;