| | |
| | | package com.java110.api.bmo.machineTranslate.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.java110.api.bmo.ApiBaseBMO; |
| | | import com.java110.api.bmo.machineTranslate.IMachineTranslateBMO; |
| | | import com.java110.core.context.DataFlowContext; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.core.smo.community.ICommunityInnerServiceSMO; |
| | | import com.java110.core.smo.fee.IFeeConfigInnerServiceSMO; |
| | | import com.java110.core.smo.file.IFileInnerServiceSMO; |
| | | import com.java110.core.smo.hardwareAdapation.IApplicationKeyInnerServiceSMO; |
| | | import com.java110.core.smo.owner.IOwnerInnerServiceSMO; |
| | | import com.java110.dto.CommunityMemberDto; |
| | | import com.java110.dto.fee.FeeConfigDto; |
| | | import com.java110.dto.file.FileDto; |
| | | import com.java110.dto.hardwareAdapation.ApplicationKeyDto; |
| | | import com.java110.dto.hardwareAdapation.CarInoutDto; |
| | | import com.java110.dto.hardwareAdapation.MachineDto; |
| | | import com.java110.dto.owner.OwnerDto; |
| | | import com.java110.utils.constant.*; |
| | | import com.java110.utils.exception.ListenerExecuteException; |
| | | 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.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName MachineTranslateBMOImpl |
| | |
| | | **/ |
| | | @Service("machineTranslateBMOImpl") |
| | | public class MachineTranslateBMOImpl extends ApiBaseBMO implements IMachineTranslateBMO { |
| | | @Autowired |
| | | private IFeeConfigInnerServiceSMO feeConfigInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private ICommunityInnerServiceSMO communityInnerServiceSMOImpl; |
| | | @Autowired |
| | | private IFileInnerServiceSMO fileInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IApplicationKeyInnerServiceSMO applicationKeyInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl; |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject deleteMachineTranslate(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_DELETE_MACHINE_TRANSLATE); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessMachineTranslate = new JSONObject(); |
| | | businessMachineTranslate.putAll(paramInJson); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessMachineTranslate", businessMachineTranslate); |
| | | return business; |
| | | } |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject addCarInoutDetail(JSONObject paramInJson, DataFlowContext dataFlowContext, String communityId, MachineDto machineDto) { |
| | | |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_CAR_INOUT); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessCarInoutDetail = new JSONObject(); |
| | | businessCarInoutDetail.put("carNum", paramInJson.getString("carNum")); |
| | | businessCarInoutDetail.put("inoutId", paramInJson.getString("inoutId")); |
| | | businessCarInoutDetail.put("communityId", communityId); |
| | | businessCarInoutDetail.put("machineId", machineDto.getMachineId()); |
| | | businessCarInoutDetail.put("machineCode", machineDto.getMachineCode()); |
| | | businessCarInoutDetail.put("carInout", machineDto.getDirection()); |
| | | businessCarInoutDetail.put("detailId", "-1"); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCarInoutDetail", businessCarInoutDetail); |
| | | return business; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject addCarInout(JSONObject paramInJson, DataFlowContext dataFlowContext, String communityId) { |
| | | |
| | | paramInJson.put("inoutId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_inoutId)); |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_CAR_INOUT); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessCarInout = new JSONObject(); |
| | | businessCarInout.put("carNum", paramInJson.getString("carNum")); |
| | | businessCarInout.put("inoutId", paramInJson.getString("inoutId")); |
| | | businessCarInout.put("communityId", communityId); |
| | | businessCarInout.put("state", "100300"); |
| | | businessCarInout.put("inTime", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCarInout", businessCarInout); |
| | | return business; |
| | | } |
| | | |
| | | /** |
| | | * 添加物业费用 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject addCarInoutFee(JSONObject paramInJson, DataFlowContext dataFlowContext, String communityId) { |
| | | return addCarInoutFee(paramInJson, dataFlowContext, communityId, DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加物业费用 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject addCarInoutFee(JSONObject paramInJson, DataFlowContext dataFlowContext, String communityId, String startTime) { |
| | | CommunityMemberDto communityMemberDto = new CommunityMemberDto(); |
| | | communityMemberDto.setCommunityId(communityId); |
| | | communityMemberDto.setMemberTypeCd(CommunityMemberTypeConstant.PROPERTY); |
| | | List<CommunityMemberDto> communityMemberDtos = communityInnerServiceSMOImpl.getCommunityMembers(communityMemberDto); |
| | | String storeId = "-1"; |
| | | if (communityMemberDtos != null && communityMemberDtos.size() > 0) { |
| | | storeId = communityMemberDtos.get(0).getMemberId(); |
| | | } |
| | | |
| | | FeeConfigDto feeConfigDto = new FeeConfigDto(); |
| | | feeConfigDto.setFeeTypeCd(FeeTypeConstant.FEE_TYPE_TEMP_DOWN_PARKING_SPACE); |
| | | feeConfigDto.setIsDefault("T"); |
| | | feeConfigDto.setCommunityId(communityId); |
| | | List<FeeConfigDto> feeConfigDtos = feeConfigInnerServiceSMOImpl.queryFeeConfigs(feeConfigDto); |
| | | if (feeConfigDtos == null || feeConfigDtos.size() != 1) { |
| | | throw new ListenerExecuteException(ResponseConstant.RESULT_CODE_ERROR, "未查到费用配置信息,查询多条数据"); |
| | | } |
| | | |
| | | feeConfigDto = feeConfigDtos.get(0); |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FEE_INFO); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 1); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("feeId", "-1"); |
| | | businessUnit.put("configId", feeConfigDto.getConfigId()); |
| | | businessUnit.put("feeTypeCd", FeeTypeConstant.FEE_TYPE_TEMP_DOWN_PARKING_SPACE); |
| | | businessUnit.put("incomeObjId", storeId); |
| | | businessUnit.put("amount", "-1.00"); |
| | | businessUnit.put("startTime", startTime); |
| | | businessUnit.put("endTime", DateUtil.getLastTime()); // 临时车将结束时间刷成2038年 |
| | | businessUnit.put("communityId", communityId); |
| | | businessUnit.put("payerObjId", paramInJson.getString("inoutId")); |
| | | businessUnit.put("payerObjType", "9999"); |
| | | businessUnit.put("feeFlag", "2006012"); // 一次性费用 |
| | | businessUnit.put("state", "2008001"); // 收费中 |
| | | businessUnit.put("userId", "-1"); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFee", businessUnit); |
| | | |
| | | return business; |
| | | } |
| | | |
| | | public JSONObject modifyCarInout(JSONObject reqJson, DataFlowContext context, CarInoutDto carInoutDto) { |
| | | return modifyCarInout(reqJson, context, carInoutDto, "100500", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | } |
| | | |
| | | public JSONObject modifyCarInout(JSONObject reqJson, DataFlowContext context, CarInoutDto carInoutDto, String state, String endTime) { |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_CAR_INOUT); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessCarInout = new JSONObject(); |
| | | businessCarInout.putAll(BeanConvertUtil.beanCovertMap(carInoutDto)); |
| | | businessCarInout.put("state", state); |
| | | businessCarInout.put("outTime", endTime); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessCarInout", businessCarInout); |
| | | return business; |
| | | } |
| | | |
| | | /** |
| | | * 保存照片 |
| | | * |
| | | * @param reqJson |
| | | * @param context |
| | | */ |
| | | public JSONObject savePhoto(JSONObject reqJson, DataFlowContext context) { |
| | | |
| | | |
| | | FileDto fileDto = new FileDto(); |
| | | fileDto.setCommunityId(reqJson.getString("communityId")); |
| | | fileDto.setFileId(reqJson.getString("fileId")); |
| | | fileDto.setFileName(reqJson.getString("fileId")); |
| | | fileDto.setContext(reqJson.getString("photo")); |
| | | fileDto.setSuffix("jpeg"); |
| | | String fileName = fileInnerServiceSMOImpl.saveFile(fileDto); |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_FILE_REL); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ + 2); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessUnit = new JSONObject(); |
| | | businessUnit.put("fileRelId", "-1"); |
| | | businessUnit.put("relTypeCd", reqJson.getString("relTypeCd")); |
| | | businessUnit.put("saveWay", "table"); |
| | | businessUnit.put("objId", reqJson.getString("machineRecordId")); |
| | | businessUnit.put("fileRealName", reqJson.getString("fileId")); |
| | | businessUnit.put("fileSaveName", fileName); |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessFileRel", businessUnit); |
| | | |
| | | return business; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject addMachineRecord(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | if (!paramInJson.containsKey("openTypeCd")) { |
| | | paramInJson.put("openTypeCd", "1000"); |
| | | } |
| | | |
| | | if (!paramInJson.containsKey("recordTypeCd")) { |
| | | paramInJson.put("openTypeCd", "8888"); |
| | | } |
| | | paramInJson.put("fileTime", DateUtil.getFormatTimeString(new Date(), DateUtil.DATE_FORMATE_STRING_A)); |
| | | |
| | | paramInJson.put("machineRecordId",GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_machineRecordId)); |
| | | |
| | | String objId = paramInJson.getString("userId"); |
| | | //这里objId 可能是 业主ID 也可能是钥匙ID |
| | | //先根据业主ID去查询 |
| | | OwnerDto ownerDto = new OwnerDto(); |
| | | ownerDto.setCommunityId(paramInJson.getString("communityId")); |
| | | ownerDto.setMemberId(objId); |
| | | List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwnerMembers(ownerDto); |
| | | |
| | | if (ownerDtos != null && ownerDtos.size() > 0) { |
| | | Assert.listOnlyOne(ownerDtos, "根据业主ID查询到多条记录"); |
| | | paramInJson.put("name", ownerDtos.get(0).getName()); |
| | | paramInJson.put("tel", ownerDtos.get(0).getLink()); |
| | | paramInJson.put("idCard", ownerDtos.get(0).getIdCard()); |
| | | paramInJson.put("relTypeCd", "60000"); |
| | | } else { //钥匙申请ID |
| | | ApplicationKeyDto applicationKeyDto = new ApplicationKeyDto(); |
| | | applicationKeyDto.setCommunityId(paramInJson.getString("communityId")); |
| | | applicationKeyDto.setApplicationKeyId(objId); |
| | | List<ApplicationKeyDto> applicationKeyDtos = applicationKeyInnerServiceSMOImpl.queryApplicationKeys(applicationKeyDto); |
| | | |
| | | Assert.listOnlyOne(applicationKeyDtos, "根据钥匙ID未查询到记录或查询到多条记录"); |
| | | |
| | | paramInJson.put("name", applicationKeyDtos.get(0).getName()); |
| | | paramInJson.put("tel", applicationKeyDtos.get(0).getTel()); |
| | | paramInJson.put("idCard", applicationKeyDtos.get(0).getIdCard()); |
| | | paramInJson.put("relTypeCd", "60000"); |
| | | |
| | | } |
| | | |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_MACHINE_RECORD); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessMachineRecord = new JSONObject(); |
| | | businessMachineRecord.putAll(paramInJson); |
| | | //businessMachineRecord.put("machineRecordId", "-1"); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessMachineRecord", businessMachineRecord); |
| | | return business; |
| | | } |
| | | /** |
| | | * 添加小区信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject addMachineTranslate(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_SAVE_MACHINE_TRANSLATE); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessMachineTranslate = new JSONObject(); |
| | | businessMachineTranslate.putAll(paramInJson); |
| | | businessMachineTranslate.put("machineTranslateId", "-1"); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessMachineTranslate", businessMachineTranslate); |
| | | return business; |
| | | } |
| | | /** |
| | | * 添加设备同步信息 |
| | | * |
| | | * @param paramInJson 接口调用放传入入参 |
| | | * @param dataFlowContext 数据上下文 |
| | | * @return 订单服务能够接受的报文 |
| | | */ |
| | | public JSONObject updateMachineTranslate(JSONObject paramInJson, DataFlowContext dataFlowContext) { |
| | | |
| | | |
| | | JSONObject business = JSONObject.parseObject("{\"datas\":{}}"); |
| | | business.put(CommonConstant.HTTP_BUSINESS_TYPE_CD, BusinessTypeConstant.BUSINESS_TYPE_UPDATE_MACHINE_TRANSLATE); |
| | | business.put(CommonConstant.HTTP_SEQ, DEFAULT_SEQ); |
| | | business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S); |
| | | JSONObject businessMachineTranslate = new JSONObject(); |
| | | businessMachineTranslate.putAll(paramInJson); |
| | | //计算 应收金额 |
| | | business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessMachineTranslate", businessMachineTranslate); |
| | | return business; |
| | | } |
| | | } |