java110 лет назад: 5
Родитель
Сommit
5220c19680

+ 4 - 2
Api/src/main/java/com/java110/api/bmo/machineTranslate/impl/MachineTranslateBMOImpl.java

@@ -229,7 +229,7 @@ public class MachineTranslateBMOImpl extends ApiBaseBMO implements IMachineTrans
         businessUnit.put("fileRelId", "-1");
         businessUnit.put("relTypeCd", reqJson.getString("relTypeCd"));
         businessUnit.put("saveWay", "table");
-        businessUnit.put("objId", reqJson.getString("userId"));
+        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);
@@ -256,6 +256,8 @@ public class MachineTranslateBMOImpl extends ApiBaseBMO implements IMachineTrans
         }
         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去查询
@@ -292,7 +294,7 @@ public class MachineTranslateBMOImpl extends ApiBaseBMO implements IMachineTrans
         business.put(CommonConstant.HTTP_INVOKE_MODEL, CommonConstant.HTTP_INVOKE_MODEL_S);
         JSONObject businessMachineRecord = new JSONObject();
         businessMachineRecord.putAll(paramInJson);
-        businessMachineRecord.put("machineRecordId", "-1");
+        //businessMachineRecord.put("machineRecordId", "-1");
         //计算 应收金额
         business.getJSONObject(CommonConstant.HTTP_BUSINESS_DATAS).put("businessMachineRecord", businessMachineRecord);
         return business;

+ 3 - 0
Api/src/main/java/com/java110/api/listener/machineRecord/ListMachineRecordsListener.java

@@ -8,6 +8,7 @@ import com.java110.core.smo.hardwareAdapation.IMachineRecordInnerServiceSMO;
 import com.java110.dto.hardwareAdapation.MachineRecordDto;
 import com.java110.event.service.api.ServiceDataFlowEvent;
 import com.java110.utils.constant.ServiceCodeMachineRecordConstant;
+import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.vo.api.machineRecord.ApiMachineRecordDataVo;
 import com.java110.vo.api.machineRecord.ApiMachineRecordVo;
@@ -57,6 +58,8 @@ public class ListMachineRecordsListener extends AbstractServiceApiListener {
     @Override
     protected void validate(ServiceDataFlowEvent event, JSONObject reqJson) {
         super.validatePageInfo(reqJson);
+        Assert.hasKeyAndValue(reqJson, "communityId", "请求报文中未包含小区信息");
+
     }
 
     @Override

+ 2 - 0
FrontService/src/main/java/com/java110/front/smo/machineRecord/impl/ListMachineRecordsSMOImpl.java

@@ -7,6 +7,7 @@ import com.java110.entity.component.ComponentValidateResult;
 import com.java110.utils.constant.PrivilegeCodeConstant;
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.exception.SMOException;
+import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.front.smo.machineRecord.IListMachineRecordsSMO;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +36,7 @@ public class ListMachineRecordsSMOImpl extends AbstractComponentSMO implements I
     protected void validate(IPageData pd, JSONObject paramIn) {
 
         super.validatePageInfo(pd);
+        Assert.hasKeyAndValue(paramIn, "communityId", "请求报文中未包含小区信息");
 
         super.checkUserHasPrivilege(pd, restTemplate, PrivilegeCodeConstant.AGENT_HAS_LIST_MACHINE_RECORD);
     }

+ 9 - 8
java110-db/src/main/resources/mapper/hardwareAdapation/MachineRecordServiceDaoImplMapper.xml

@@ -6,13 +6,13 @@
 
     <!-- 保存设备上报信息 add by wuxw 2018-07-03 -->
     <insert id="saveBusinessMachineRecordInfo" parameterType="Map">
-           insert into business_machine_record(
-file_time,machine_code,open_type_cd,id_card,machine_record_id,machine_id,operate,`name`,tel,community_id,b_id,file_id,record_type_cd
-) values (
-#{fileTime},#{machineCode},#{openTypeCd},#{idCard},#{machineRecordId},#{machineId},#{operate},#{name},#{tel},#{communityId},#{bId},#{fileId}
-,#{recordTypeCd}
-)
-       </insert>
+        insert into business_machine_record(
+        file_time,machine_code,open_type_cd,id_card,machine_record_id,machine_id,operate,`name`,tel,community_id,b_id,file_id,record_type_cd
+        ) values (
+        #{fileTime},#{machineCode},#{openTypeCd},#{idCard},#{machineRecordId},#{machineId},#{operate},#{name},#{tel},#{communityId},#{bId},#{fileId}
+        ,#{recordTypeCd}
+        )
+    </insert>
 
 
     <!-- 查询设备上报信息(Business) add by wuxw 2018-07-03 -->
@@ -119,7 +119,8 @@ file_time,machine_code,open_type_cd,id_card,machine_record_id,machine_id,operate
         select t.file_time,t.file_time fileTime,t.machine_code,t.machine_code machineCode,t.open_type_cd,t.open_type_cd
         openTypeCd,t.id_card,t.id_card idCard,t.status_cd,t.status_cd statusCd,t.machine_record_id,t.machine_record_id
         machineRecordId,t.machine_id,t.machine_id machineId,t.name,t.tel,t.community_id,t.community_id
-        communityId,t.b_id,t.b_id bId,t.file_id,t.file_id fileId,t.record_type_cd,t.record_type_cd recordTypeCd,td1.name openTypeName
+        communityId,t.b_id,t.b_id bId,t.file_id,t.file_id fileId,t.record_type_cd,t.record_type_cd recordTypeCd,td1.name
+        openTypeName
         from machine_record t,t_dict td1
         where 1 =1
         and t.open_type_cd = td1.status_cd