| | |
| | | private String merchantId; |
| | | private String direction; |
| | | |
| | | |
| | | public String getInoutId() { |
| | | return inoutId; |
| | | } |
| | |
| | | |
| | | public static final String CAR_TYPE_CD_TEMP = "1003"; |
| | | |
| | | public static final String LEASE_TYPE_MONTH = "H"; // 月租车 |
| | | public static final String LEASE_TYPE_SALE = "S"; // 出售车 |
| | | public static final String LEASE_TYPE_INNER = "I"; //内部车 |
| | | public static final String LEASE_TYPE_NO_MONEY = "NM"; //免费车 |
| | | public static final String LEASE_TYPE_RESERVE = "R"; //预约车 |
| | | // public static final String LEASE_TYPE_MONTH = "H"; // 月租车 |
| | | // public static final String LEASE_TYPE_SALE = "S"; // 出售车 |
| | | // public static final String LEASE_TYPE_INNER = "I"; //内部车 |
| | | // public static final String LEASE_TYPE_NO_MONEY = "NM"; //免费车 |
| | | // public static final String LEASE_TYPE_RESERVE = "R"; //预约车 |
| | | |
| | | public static final String LEASE_TYPE_TEMP = "T";//临时车 |
| | | |
| | | public static final String LEASE_TYPE_STORE = "S"; // 商铺车 |
| | | public static final String LEASE_TYPE_INNER = "I"; //业委会照顾车 |
| | | public static final String LEASE_TYPE_NO_MONEY = "NM"; //小业主产权车 |
| | | public static final String LEASE_TYPE_RESERVE = "R"; //租客车 |
| | | |
| | | public static final String CAR_TYPE_CREDIT = "9906"; //信用期车牌 |
| | | |
| | | private String carColor; |
| | |
| | | private String direction; |
| | | private String bId; |
| | | private String createTime; |
| | | private String errorTest; |
| | | private String communityName; |
| | | |
| | | |
| | | public String getInoutId() { |
| | |
| | | public void setCreateTime(String createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public String getErrorTest() { |
| | | return errorTest; |
| | | } |
| | | |
| | | public void setErrorTest(String errorTest) { |
| | | this.errorTest = errorTest; |
| | | } |
| | | |
| | | public String getCommunityName() { |
| | | return communityName; |
| | | } |
| | | |
| | | public void setCommunityName(String communityName) { |
| | | this.communityName = communityName; |
| | | } |
| | | } |
| | |
| | | status_cd, |
| | | pa_id |
| | | ) VALUES |
| | | <!-- 将 collection="carInoutList" 改为 collection="list" --> |
| | | <foreach collection="list" item="item" separator=","> |
| | | ( |
| | | #{item.inoutId}, |
| | | #{item.bId}, |
| | | #{item.communityId}, |
| | | #{item.carNum}, |
| | | #{item.vehicleType}, |
| | | #{item.paymentAmount}, |
| | | #{item.merchantId}, |
| | | #{item.direction}, |
| | | #{item.state}, |
| | | #{item.inTime}, |
| | | #{item.outTime}, |
| | | #{item.createTime}, |
| | | #{item.statusCd}, |
| | | #{item.paId} |
| | | #{inoutId}, |
| | | #{bId}, |
| | | #{communityId}, |
| | | #{carNum}, |
| | | #{vehicleType}, |
| | | #{paymentAmount}, |
| | | #{merchantId}, |
| | | #{direction}, |
| | | #{state}, |
| | | #{inTime}, |
| | | #{outTime}, |
| | | #{createTime}, |
| | | #{statusCd}, |
| | | #{paId} |
| | | ) |
| | | </foreach> |
| | | </insert> |
| | | </mapper> |
| | |
| | | |
| | | <!-- 查询车辆进出场信息 add by wuxw 2018-07-03 --> |
| | | <select id="getCarInoutInfo" parameterType="Map" resultType="Map"> |
| | | select t.in_time,t.in_time inTime,t.inout_id,t.inout_id inoutId,t.pa_id,t.pa_id paId,t.car_num,t.car_num |
| | | carNum,t.status_cd,t.status_cd statusCd,t.state,t.community_id,t.community_id communityId,t.out_time,t.out_time |
| | | outTime,td.`name` stateName,pa.num areaNum,tcfc.fee_name feeName,tcfc.config_id configId,max(cid.car_type) carType,max(cid.car_type_name) carTypeName |
| | | from car_inout t |
| | | LEFT JOIN car_inout_detail cid on t.inout_id = cid.inout_id and cid.status_cd = '0' and cid.state in ('100300','100400','100600') |
| | | left join t_dict td on t.state = td.status_cd and td.table_columns='state' and td.table_name = 'car_inout' |
| | | left join parking_area pa on t.pa_id = pa.pa_id and pa.status_cd = '0' |
| | | left join temp_car_fee_config tcfc on pa.pa_id = tcfc.pa_id and tcfc.status_cd = '0' |
| | | where 1 =1 |
| | | <if test="inTime !=null and inTime != ''"> |
| | | and t.in_time= #{inTime} |
| | | SELECT |
| | | -- 出场记录字段 |
| | | out_rec.in_time outInTime, |
| | | out_rec.inout_id outInoutId, |
| | | out_rec.pa_id paId, |
| | | out_rec.car_num carNum, |
| | | out_rec.vehicle_type vehicleType, |
| | | out_rec.payment_amount paymentAmount, |
| | | out_rec.merchant_id merchantId, |
| | | out_rec.direction, |
| | | out_rec.status_cd statusCd, |
| | | out_rec.state outState, |
| | | out_rec.community_id communityId, |
| | | out_rec.out_time outTime, |
| | | -- 关联的进场记录字段 |
| | | in_rec.in_time inTime, |
| | | in_rec.inout_id inInoutId, |
| | | in_rec.state inState, |
| | | -- 其他关联信息 |
| | | td_out.`name` outStateName, |
| | | td_in.`name` inStateName, |
| | | pa.num areaNum, |
| | | tcfc.fee_name feeName, |
| | | tcfc.config_id configId, |
| | | MAX(cid_out.car_type) carType, |
| | | MAX(cid_out.car_type_name) carTypeName, |
| | | -- 停车时长 |
| | | TIMESTAMPDIFF(MINUTE, in_rec.in_time, out_rec.out_time) parkMinutes |
| | | FROM car_inout out_rec |
| | | -- 关联最新的进场记录 |
| | | LEFT JOIN ( |
| | | SELECT |
| | | car_num, in_time, inout_id, state, pa_id, community_id, |
| | | ROW_NUMBER() OVER (PARTITION BY car_num ORDER BY in_time DESC) rn |
| | | FROM car_inout |
| | | WHERE state = '100300' -- 进场状态 |
| | | AND status_cd = '0' |
| | | ) in_rec ON out_rec.car_num = in_rec.car_num |
| | | AND out_rec.in_time > in_rec.in_time |
| | | AND in_rec.rn = 1 |
| | | AND out_rec.pa_id = in_rec.pa_id |
| | | |
| | | -- 原有关联表(调整为关联出场记录) |
| | | LEFT JOIN car_inout_detail cid_out ON out_rec.inout_id = cid_out.inout_id |
| | | AND cid_out.status_cd = '0' |
| | | AND cid_out.state IN ('100300','100400','100600') |
| | | LEFT JOIN t_dict td_out ON out_rec.state = td_out.status_cd |
| | | AND td_out.table_columns = 'state' |
| | | AND td_out.table_name = 'car_inout' |
| | | LEFT JOIN t_dict td_in ON in_rec.state = td_in.status_cd |
| | | AND td_in.table_columns = 'state' |
| | | AND td_in.table_name = 'car_inout' |
| | | LEFT JOIN parking_area pa ON out_rec.pa_id = pa.pa_id |
| | | AND pa.status_cd = '0' |
| | | LEFT JOIN temp_car_fee_config tcfc ON pa.pa_id = tcfc.pa_id |
| | | AND tcfc.status_cd = '0' |
| | | |
| | | WHERE 1 = 1 |
| | | -- 主表筛选离场记录 |
| | | AND out_rec.state = '100500' -- 离场状态 |
| | | AND out_rec.status_cd = '0' |
| | | |
| | | -- 保留原始所有查询条件(调整别名适配新结构) |
| | | <if test="inTime != null and inTime != ''"> |
| | | AND in_rec.in_time = #{inTime} |
| | | </if> |
| | | <if test="inoutId !=null and inoutId != ''"> |
| | | and t.inout_id= #{inoutId} |
| | | <if test="inoutId != null and inoutId != ''"> |
| | | AND out_rec.inout_id = #{inoutId} |
| | | </if> |
| | | <if test="paId !=null and paId != ''"> |
| | | and t.pa_id= #{paId} |
| | | <if test="paId != null and paId != ''"> |
| | | AND out_rec.pa_id = #{paId} |
| | | </if> |
| | | <if test="paIds !=null"> |
| | | and t.pa_id in |
| | | <if test="paIds != null"> |
| | | AND out_rec.pa_id IN |
| | | <foreach collection="paIds" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="carNum !=null and carNum != ''"> |
| | | and t.car_num like concat('%',#{carNum},'%') |
| | | <if test="carNum != null and carNum != ''"> |
| | | AND out_rec.car_num LIKE CONCAT('%', #{carNum}, '%') |
| | | </if> |
| | | <if test="carType !=null and carType != ''"> |
| | | and cid.car_type= #{carType} |
| | | <if test="carType != null and carType != ''"> |
| | | AND cid_out.car_type = #{carType} |
| | | </if> |
| | | <if test="statusCd !=null and statusCd != ''"> |
| | | and t.status_cd= #{statusCd} |
| | | <if test="statusCd != null and statusCd != ''"> |
| | | AND out_rec.status_cd = #{statusCd} |
| | | </if> |
| | | <if test="state !=null and state != ''"> |
| | | and t.state= #{state} |
| | | <if test="state != null and state != ''"> |
| | | AND out_rec.state = #{state} |
| | | </if> |
| | | <if test="states !=null"> |
| | | and t.state in |
| | | <if test="states != null"> |
| | | AND out_rec.state IN |
| | | <foreach collection="states" item="item" open="(" close=")" separator=","> |
| | | #{item} |
| | | </foreach> |
| | | </if> |
| | | <if test="communityId !=null and communityId != ''"> |
| | | and t.community_id= #{communityId} |
| | | <if test="communityId != null and communityId != ''"> |
| | | AND out_rec.community_id = #{communityId} |
| | | </if> |
| | | <if test="outTime !=null and outTime != ''"> |
| | | and t.out_time= #{outTime} |
| | | <if test="outTime != null and outTime != ''"> |
| | | AND out_rec.out_time = #{outTime} |
| | | </if> |
| | | <if test="startTime !=null and startTime != ''"> |
| | | and t.in_time > #{startTime} |
| | | <if test="startTime != null and startTime != ''"> |
| | | AND in_rec.in_time > #{startTime} |
| | | </if> |
| | | <if test="endTime !=null and endTime != ''"> |
| | | and t.in_time < #{endTime} |
| | | <if test="endTime != null and endTime != ''"> |
| | | AND in_rec.in_time < #{endTime} |
| | | </if> |
| | | group by t.in_time,t.inout_id,t.pa_id,t.car_num,t.status_cd,t.state,t.community_id,t.out_time,td.`name`,pa.num,tcfc.fee_name,tcfc.config_id,t.create_time |
| | | order by t.create_time desc |
| | | |
| | | GROUP BY |
| | | out_rec.in_time, out_rec.inout_id, out_rec.pa_id, out_rec.car_num, |
| | | out_rec.status_cd, out_rec.state, out_rec.community_id, out_rec.out_time, |
| | | in_rec.in_time, in_rec.inout_id, in_rec.state, |
| | | td_out.`name`, td_in.`name`, pa.num, tcfc.fee_name, tcfc.config_id |
| | | |
| | | ORDER BY out_rec.create_time DESC |
| | | |
| | | <if test="page != -1 and page != null "> |
| | | limit #{page}, #{row} |
| | | </if> |
| | | |
| | | </select> |
| | | |
| | | |
| | |
| | | where 1 =1 |
| | | <if test="inTime !=null and inTime != ''"> |
| | | and t.in_time= #{inTime} |
| | | </if> |
| | | <if test="inoutId !=null and inoutId != ''"> |
| | | and t.inout_id= #{inoutId} |
| | | </if> |
| | | <if test="paId !=null and paId != ''"> |
| | | and t.pa_id= #{paId} |
| | |
| | | <if test="feeYear != null and feeYear != ''"> |
| | | and YEAR(charge_time) = #{feeYear} |
| | | </if> |
| | | <if test="communityId != null and communityId != ''"> |
| | | and community_id = #{communityId} |
| | | </if> |
| | | </where> |
| | | |
| | | <!-- 排序 --> |
| | |
| | | <if test="feeYear != null and feeYear != ''"> |
| | | and YEAR(charge_time) = #{feeYear} |
| | | </if> |
| | | <if test="communityId != null and communityId != ''"> |
| | | and community_id = #{communityId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | <select id="countPropertyWhiteListFlowFilter" parameterType="Map" resultType="Map"> |
| | |
| | | <if test="chargeEnd != null"> |
| | | AND charge_end = #{chargeEnd} |
| | | </if> |
| | | <if test="communityId != null and communityId != ''"> |
| | | and community_id = #{communityId} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | public FilterRegistrationBean jwtFilter() { |
| | | StringBuffer exclusions = new StringBuffer(); |
| | | exclusions.append("/app/carInout.*,"); |
| | | exclusions.append("/app/import.CarInout,"); |
| | | exclusions.append("/app/import.QueryCarInout,"); |
| | | exclusions.append("/callComponent/login/*,"); |
| | | exclusions.append("/secondaryFeeTypeCdGl/*,"); |
| | | exclusions.append("/app/ext/992020051967020024/query_token,"); |
| | |
| | | Assert.hasValue(os[0], (osIndex + 1) + "车牌号不能为空"); |
| | | Assert.hasValue(os[1], (osIndex + 1) + "业主不能为空"); |
| | | // Assert.hasValue(os[2], (osIndex + 1) + "手机号不能为空"); |
| | | Assert.hasValue(os[3], (osIndex + 1) + "车辆品牌不能为空"); |
| | | Assert.hasValue(os[4], (osIndex + 1) + "车辆类型不能为空"); |
| | | Assert.hasValue(os[5], (osIndex + 1) + "颜色不能为空"); |
| | | Assert.hasValue(os[6], (osIndex + 1) + "停车场不能为空"); |
| | | Assert.hasValue(os[7], (osIndex + 1) + "车位不能为空"); |
| | | // Assert.hasValue(os[3], (osIndex + 1) + "车辆品牌不能为空"); |
| | | // Assert.hasValue(os[4], (osIndex + 1) + "车辆类型不能为空"); |
| | | // Assert.hasValue(os[5], (osIndex + 1) + "颜色不能为空"); |
| | | // Assert.hasValue(os[6], (osIndex + 1) + "停车场不能为空"); |
| | | // Assert.hasValue(os[7], (osIndex + 1) + "车位不能为空"); |
| | | Assert.hasValue(os[8], (osIndex + 1) + "起租时间不能为空"); |
| | | Assert.hasValue(os[9], (osIndex + 1) + "截止时间不能为空"); |
| | | Assert.hasValue(os[10], (osIndex + 1) + "停车场类型不能为空"); |
| | | // Assert.hasValue(os[10], (osIndex + 1) + "停车场类型不能为空"); |
| | | Assert.hasValue(os[11], (osIndex + 1) + "车位类型不能为空"); |
| | | String startTime = excelDoubleToDate(os[8].toString()); |
| | | String endTime = excelDoubleToDate(os[9].toString()); |
| | |
| | | importOwnerCar.setCarNum(os[0].toString().trim()); |
| | | importOwnerCar.setOwnerName(os[1].toString().trim()); |
| | | importOwnerCar.setLink(os[2] == null ? "" : os[2].toString().trim()); |
| | | importOwnerCar.setCarBrand(os[3].toString().trim()); |
| | | importOwnerCar.setCarType(os[4].toString().trim()); |
| | | importOwnerCar.setCarColor(os[5].toString().trim()); |
| | | importOwnerCar.setAreaNum(os[6].toString().trim()); |
| | | importOwnerCar.setCarBrand(os[3] == null ? "" : os[3].toString().trim()); |
| | | importOwnerCar.setCarType(os[4] == null ? "" : os[4].toString().trim()); |
| | | importOwnerCar.setCarColor(os[5] == null ? "" : os[5].toString().trim()); |
| | | importOwnerCar.setAreaNum(os[6] == null ? "" : os[6].toString().trim()); |
| | | //获取车位 |
| | | String parkingLot = os[7].toString().trim(); |
| | | String parkingLot = os[7] == null ? "" : os[7].toString().trim(); |
| | | importOwnerCar.setNum(parkingLot); |
| | | importOwnerCar.setLogStartTime(startTime); |
| | | importOwnerCar.setLogEndTime(endTime); |
| | | importOwnerCar.setTypeCd(os[10].toString().trim()); |
| | | importOwnerCar.setTypeCd(os[10] == null ? "" : os[10].toString().trim()); |
| | | importOwnerCar.setSpaceSate(os[11].toString().trim()); |
| | | importOwnerCar.setCommunityId(result.getCommunityId()); |
| | | importOwnerCar.setUserId(result.getUserId()); |
| | |
| | | */ |
| | | private void validateCarInfo(List<OwnerCarDto> ownerCars) { |
| | | for (OwnerCarDto ownerCarDto : ownerCars) { |
| | | |
| | | if ("".equals(ownerCarDto.getTypeCd()) || ownerCarDto.getTypeCd() == null) { |
| | | continue; |
| | | } |
| | | if (!"1001".equals(ownerCarDto.getTypeCd()) && !"2001".equals(ownerCarDto.getTypeCd())) { |
| | | throw new IllegalArgumentException(ownerCarDto.getCarNum() + "停车场类型应填写 1001(地上停车场)或者 2001 (地下停车场)"); |
| | | } |
| | |
| | | assetImportLogPo.setErrorCount("0"); |
| | | assetImportLogPo.setSuccessCount("0"); |
| | | String userId = null; |
| | | try { |
| | | userId = new ObjectMapper().readValue(pd.getReqData(), HashMap.class).get("userId").toString(); |
| | | } catch (JsonMappingException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (JsonParseException e) { |
| | | throw new RuntimeException(e); |
| | | } catch (IOException e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | userId = pd.getUserId(); |
| | | if(userId != null) { |
| | | UserDto userDto = new UserDto(); |
| | | userDto.setUserId(userId); |
| | |
| | | import com.java110.po.car.CarInoutPo; |
| | | import com.java110.utils.constant.ResponseConstant; |
| | | import com.java110.utils.exception.DAOException; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | | import com.java110.utils.util.DateUtil; |
| | | import org.activiti.engine.impl.util.CollectionUtil; |
| | | import org.slf4j.Logger; |
| | | import com.java110.core.log.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | @Autowired |
| | | private CarInoutServiceDaoImpl carInoutServiceDaoImpl; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public int[] batchSaveCarInout(List<CarInoutPo> successRecords) { |
| | |
| | | } |
| | | |
| | | int totalSize = successRecords.size(); |
| | | int[] result = new int[totalSize]; // 存储每条记录的插入结果(默认 0 表示失败) |
| | | int batchSize = 500; // 每批插入 500 条 |
| | | int batchCount = 0; // 记录当前处理到第几批 |
| | | int[] result = new int[totalSize]; // 存储每条记录的插入结果(0表示失败,1表示成功) |
| | | |
| | | for (int i = 0; i < totalSize; i += batchSize) { |
| | | // 截取当前批次数据 |
| | | List<CarInoutPo> batchList = successRecords.subList(i, Math.min(i + batchSize, totalSize)); |
| | | for (int i = 0; i < totalSize; i++) { |
| | | CarInoutPo record = successRecords.get(i); |
| | | try { |
| | | |
| | | // 执行批量插入,返回当前批次总影响行数 |
| | | int batchAffectedRows = sqlSessionTemplate.insert( |
| | | "carInoutServiceDaoImpl.batchInsert", |
| | | batchList |
| | | ); |
| | | int existCount = carInoutServiceDaoImpl.queryCarInoutsCount(BeanConvertUtil.beanCovertMap(record)); |
| | | |
| | | // 标记当前批次记录为成功(简单处理:假设要么全成功,要么全失败) |
| | | if (batchAffectedRows == batchList.size()) { |
| | | for (int j = i; j < i + batchSize && j < totalSize; j++) { |
| | | result[j] = 1; // 1 表示插入成功 |
| | | if (existCount > 0) { |
| | | // 3. 记录已存在,标记为去重(可用2表示去重,与0/1区分) |
| | | record.setErrorTest("重复的内容"); |
| | | continue; |
| | | } |
| | | } else { |
| | | // 批次插入失败(如主键冲突、字段错误),标记为 0 |
| | | for (int j = i; j < i + batchSize && j < totalSize; j++) { |
| | | result[j] = 0; // 0 表示插入失败 |
| | | |
| | | // 逐条插入 |
| | | int affectedRows = sqlSessionTemplate.insert( |
| | | "carInoutServiceDaoImpl.batchInsert", // 注意这里需要改为单条插入的statement ID |
| | | BeanConvertUtil.beanCovertMap(record) |
| | | ); |
| | | |
| | | // 单条插入成功 |
| | | if (affectedRows > 0) { |
| | | result[i] = 1; |
| | | } else { |
| | | result[i] = 0; |
| | | } |
| | | } catch (Exception e) { |
| | | // 捕获SQL异常,标记为失败 |
| | | result[i] = 0; |
| | | // 可以根据需要记录错误日志 |
| | | record.setErrorTest("插入CarInoutPo失败,记录: "+e); |
| | | } |
| | | |
| | | batchCount++; |
| | | } |
| | | |
| | | return result; |
| | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setCarNum(parkingSpaceApplyPo.getCarNum()); |
| | | ownerCarDto.setCommunityId(parkingSpaceApplyPo.getCommunityId()); |
| | | ownerCarDto.setLeaseType(OwnerCarDto.LEASE_TYPE_MONTH); |
| | | ownerCarDto.setLeaseType(OwnerCarDto.LEASE_TYPE_TEMP); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarV1InnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | String catId = ""; |
| | | OwnerCarPo ownerCarPo = new OwnerCarPo(); |
| | |
| | | ownerCarPo.setState("1001"); |
| | | ownerCarPo.setUserId(userId); |
| | | ownerCarPo.setRemark("车位申请,系统自动写入"); |
| | | ownerCarPo.setLeaseType(OwnerCarDto.LEASE_TYPE_MONTH); |
| | | ownerCarPo.setLeaseType(OwnerCarDto.LEASE_TYPE_TEMP); |
| | | flag = ownerCarV1InnerServiceSMOImpl.saveOwnerCar(ownerCarPo); |
| | | if (flag < 1) { |
| | | throw new CmdException("更新数据失败"); |
| | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setCarNum(parkingSpaceApplyPo.getCarNum()); |
| | | ownerCarDto.setCommunityId(parkingSpaceApplyPo.getCommunityId()); |
| | | ownerCarDto.setLeaseType(OwnerCarDto.LEASE_TYPE_MONTH); |
| | | ownerCarDto.setLeaseType(OwnerCarDto.LEASE_TYPE_RESERVE); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarV1InnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | String catId = ""; |
| | | if (ownerCarDtos == null || ownerCarDtos.size() < 1) { |
| | |
| | | ownerCarDto.setCarNum(carInoutDetailPo.getCarNum()); |
| | | ownerCarDto.setCommunityId(communityId); |
| | | ownerCarDto.setLeaseTypes(new String[]{OwnerCarDto.LEASE_TYPE_INNER, |
| | | OwnerCarDto.LEASE_TYPE_MONTH, |
| | | OwnerCarDto.LEASE_TYPE_STORE, |
| | | OwnerCarDto.LEASE_TYPE_NO_MONEY, |
| | | OwnerCarDto.LEASE_TYPE_SALE}); |
| | | OwnerCarDto.LEASE_TYPE_RESERVE}); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarV1InnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | |
| | | if (ownerCarDtos == null || ownerCarDtos.size() < 1) { |
| | |
| | | ownerCarDto.setCarNum(carInoutDetailPo.getCarNum()); |
| | | ownerCarDto.setCommunityId(communityId); |
| | | ownerCarDto.setLeaseTypes(new String[]{OwnerCarDto.LEASE_TYPE_INNER, |
| | | OwnerCarDto.LEASE_TYPE_MONTH, |
| | | OwnerCarDto.LEASE_TYPE_STORE, |
| | | OwnerCarDto.LEASE_TYPE_NO_MONEY, |
| | | OwnerCarDto.LEASE_TYPE_SALE}); |
| | | OwnerCarDto.LEASE_TYPE_RESERVE}); |
| | | List<OwnerCarDto> ownerCarDtos = ownerCarV1InnerServiceSMOImpl.queryOwnerCars(ownerCarDto); |
| | | |
| | | if(ownerCarDtos == null || ownerCarDtos.size()<1){ |
| | |
| | | |
| | | // 将解析成功的数据存入数据库,使用你的Service实现 |
| | | if (result.getSuccessRecords() != null && !result.getSuccessRecords().isEmpty()) { |
| | | int min = 100000000; |
| | | int max = 999999999; |
| | | Random RANDOM = new Random(); |
| | | for (CarInoutPo carInoutPo : result.getSuccessRecords()) { |
| | | // carInoutPo.setInoutId("937510345"); |
| | | carInoutPo.setInoutId((min + RANDOM.nextInt(max - min + 1))+""); |
| | | carInoutPo.setCommunityId(community.getCommunityId()); |
| | | } |
| | | int[] counts = carInoutInnerServiceSMOImpl.batchSaveCarInout(result.getSuccessRecords()); |
| | | log.info("成功导入 {} 条记录到小区: {} 的 {} 日期数据", |
| | | Arrays.stream(counts).sum(), communityName, date); |
| | | } |
| | | |
| | | // 处理失败的记录,生成错误Excel并上传到OSS |
| | | if (result.getErrorRecords() != null && !result.getErrorRecords().isEmpty()) { |
| | | handleErrorRecords(ossClient, bucketName, communityName, date, fileName, result.getErrorRecords()); |
| | | log.info("小区: {} 的 {} 日期数据中有 {} 条记录导入失败,已生成错误文件", |
| | | communityName, date, result.getErrorRecords().size()); |
| | | // 统计成功和失败的总条数 |
| | | int successTotal = 0; |
| | | int errorTotal = 0; |
| | | for (int count : counts) { |
| | | if (count == 1) { |
| | | successTotal++; |
| | | } else { |
| | | errorTotal++; |
| | | } |
| | | } |
| | | |
| | | // 输出总体导入结果日志 |
| | | log.info("小区: {} 的 {} 日期数据导入完成 - 总记录数: {}, 成功: {}, 失败: {}", |
| | | communityName, date, counts.length, successTotal, errorTotal); |
| | | |
| | | // 处理失败的记录,生成错误Excel并上传到OSS |
| | | if (errorTotal > 0) { |
| | | // 收集具体失败的记录(根据counts数组筛选) |
| | | List<ErrorExcelRowData> failedRecords = new ArrayList<>(); |
| | | for (int i = 0; i < counts.length; i++) { |
| | | if (counts[i] == 0) { |
| | | failedRecords.add(convertPoToErrorRowData(result.getSuccessRecords().get(i))); |
| | | } |
| | | } |
| | | |
| | | handleErrorRecords(ossClient, bucketName, communityName, date, fileName, failedRecords); |
| | | log.info("小区: {} 的 {} 日期数据中,{} 条失败记录已生成错误文件", |
| | | communityName, date, errorTotal); |
| | | } |
| | | } |
| | | |
| | | inputStream.close(); |
| | |
| | | out.close(); |
| | | inputStream.close(); |
| | | |
| | | log.info("错误记录文件已上传至: {}", errorFileKey); |
| | | System.out.println("错误记录文件已上传至: "+errorFileKey); |
| | | } catch (Exception e) { |
| | | log.error("处理错误记录时发生异常", e); |
| | | } |
| | | } |
| | | |
| | | private ErrorExcelRowData convertPoToErrorRowData(CarInoutPo po) { |
| | | ErrorExcelRowData errorRow = new ErrorExcelRowData(); |
| | | // 根据实际字段映射关系赋值 |
| | | errorRow.setPlateNumber(po.getCarNum()); // 车牌号 |
| | | // errorRow.setCommunityName(po.getCommunityName()); // 若CarInoutPo有小区名称字段 |
| | | errorRow.setEntryTime(po.getInTime()); // 进场时间 |
| | | errorRow.setExitName(po.getOutTime()); // 离场时间(原代码中ExcelRowData的exitName实际对应离场时间) |
| | | errorRow.setVehicleType(po.getVehicleType()); // 车辆类型 |
| | | errorRow.setPaidStatus(po.getState()); // 支付状态 |
| | | errorRow.setPaymentAmount(po.getPaymentAmount()); // 支付金额 |
| | | errorRow.setMerchantId(po.getMerchantId()); // 商户ID |
| | | errorRow.setDirection(po.getDirection()); // 方向 |
| | | // 可在此处设置错误原因(如数据库插入失败的具体原因) |
| | | errorRow.setErrorReason(po.getErrorTest()); |
| | | return errorRow; |
| | | } |
| | | |
| | | /** |
| | | * 解析Excel文件并验证数据,分离成功和失败的记录 |
| | | */ |
| | |
| | | } |
| | | |
| | | if (!StringUtil.isEmpty(state) && !state.equals("F")) { |
| | | throw new IllegalArgumentException(ownerCarDto.getAreaNum() + "停车场-" + ownerCarDto.getNum() + "停车位不是空闲状态!"); |
| | | // throw new IllegalArgumentException(ownerCarDto.getAreaNum() + "停车场-" + ownerCarDto.getNum() + "停车位不是空闲状态!"); |
| | | } |
| | | ownerCarPo.setPsId(psId); |
| | | ownerCarPo.setOwnerId(ownerCarDto.getOwnerId()); |
| | |
| | | |
| | | OwnerCarDto ownerCarDto = new OwnerCarDto(); |
| | | ownerCarDto.setLeaseTypes(new String[]{OwnerCarDto.LEASE_TYPE_INNER, |
| | | OwnerCarDto.LEASE_TYPE_MONTH, |
| | | OwnerCarDto.LEASE_TYPE_SALE, |
| | | OwnerCarDto.LEASE_TYPE_STORE, |
| | | OwnerCarDto.LEASE_TYPE_NO_MONEY, |
| | | OwnerCarDto.LEASE_TYPE_RESERVE |
| | | }); |
| | |
| | | |
| | | ReportCarDto reportCarDto = new ReportCarDto(); |
| | | reportCarDto.setCommunityId(reportFeeMonthStatisticsPo.getCommunityId()); |
| | | reportCarDto.setLeaseTypes(new String[]{OwnerCarDto.LEASE_TYPE_MONTH,OwnerCarDto.LEASE_TYPE_INNER,OwnerCarDto.LEASE_TYPE_SALE,OwnerCarDto.LEASE_TYPE_NO_MONEY}); |
| | | reportCarDto.setLeaseTypes(new String[]{OwnerCarDto.LEASE_TYPE_INNER, |
| | | OwnerCarDto.LEASE_TYPE_STORE, |
| | | OwnerCarDto.LEASE_TYPE_NO_MONEY, |
| | | OwnerCarDto.LEASE_TYPE_RESERVE}); |
| | | int count = reportCommunityServiceDaoImpl.getCarCount(reportCarDto); |
| | | |
| | | |
| | |
| | | if (StringUtil.isEmpty(psId) || "-1".equals(psId)) { |
| | | throw new IllegalArgumentException("车位已经被释放,不允许修改车辆信息"); |
| | | } |
| | | if (!reqJson.containsKey("leaseType")) { |
| | | reqJson.put("leaseType", OwnerCarDto.LEASE_TYPE_MONTH); |
| | | } |
| | | // if (!reqJson.containsKey("leaseType")) { |
| | | // reqJson.put("leaseType", OwnerCarDto.LEASE_TYPE_MONTH); |
| | | // } |
| | | |
| | | // if (!OwnerCarDto.LEASE_TYPE_MONTH.equals(reqJson.getString("leaseType"))) { |
| | | // reqJson.put("startTime", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_B)); |
| | |
| | | Assert.hasKeyAndValue(reqJson, "carType", "请求报文中未包含carType"); |
| | | // Assert.hasKeyAndValue(reqJson, "psId", "未包含psId"); |
| | | |
| | | if (OwnerCarDto.LEASE_TYPE_MONTH.equals(reqJson.getString("leaseType"))) { |
| | | Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含开始时间"); |
| | | Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含结束时间"); |
| | | Assert.isDate(reqJson.getString("startTime"),DateUtil.DATE_FORMATE_STRING_B,"开始时间格式错误"); |
| | | Assert.isDate(reqJson.getString("endTime"),DateUtil.DATE_FORMATE_STRING_B,"结束时间格式错误"); |
| | | } |
| | | // if (OwnerCarDto.LEASE_TYPE_MONTH.equals(reqJson.getString("leaseType"))) { |
| | | // Assert.hasKeyAndValue(reqJson, "startTime", "请求报文中未包含开始时间"); |
| | | // Assert.hasKeyAndValue(reqJson, "endTime", "请求报文中未包含结束时间"); |
| | | // Assert.isDate(reqJson.getString("startTime"),DateUtil.DATE_FORMATE_STRING_B,"开始时间格式错误"); |
| | | // Assert.isDate(reqJson.getString("endTime"),DateUtil.DATE_FORMATE_STRING_B,"结束时间格式错误"); |
| | | // } |
| | | |
| | | String startTime = reqJson.getString("startTime"); |
| | | String endTime = reqJson.getString("endTime"); |
| | |
| | | @Override |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException { |
| | | if (!reqJson.containsKey("leaseType")) { |
| | | reqJson.put("leaseType", OwnerCarDto.LEASE_TYPE_MONTH); |
| | | } |
| | | // if (!reqJson.containsKey("leaseType")) { |
| | | // reqJson.put("leaseType", OwnerCarDto.LEASE_TYPE_MONTH); |
| | | // } |
| | | |
| | | JSONObject businessOwnerCar = new JSONObject(); |
| | | businessOwnerCar.putAll(reqJson); |
| | |
| | | spring: |
| | | profiles: |
| | | active: debug |
| | | |
| | | active: dev |
| | | |
| | | # docker build -t lx . |
| | | # |