Browse Source

Merge branch 'pt' of dd.tall.wiki:ccsens_wiki/ccsenscloud into pt

recovery
wang0018 4 years ago
parent
commit
239d9505f2
  1. 6
      wisdomcar/src/main/java/com/ccsens/wisdomcar/api/RecordController.java
  2. 13
      wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java
  3. 2
      wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml

6
wisdomcar/src/main/java/com/ccsens/wisdomcar/api/RecordController.java

@ -40,6 +40,9 @@ public class RecordController {
@RequestMapping(value = "/weightList", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
public JsonResponse<RecordVo.WeightAndRfid> timeList(@ApiParam @Validated @RequestBody QueryDto<RecordDto.WeightAndRfid> params){
log.info("查询智慧平车称重和rfid记录:{}", params);
if (params.getParam().getEndTime() != null) {
params.getParam().setEndTime(params.getParam().getEndTime() + 24 * 3600 *1000);
}
List<RecordVo.WeightAndRfid> list = recordService.queryWeightAndRfid(params.getParam(), params.getUserId());
log.info("查询智慧平车称重和rfid记录结果:{}",list);
return JsonResponse.newInstance().ok(list);
@ -49,6 +52,9 @@ public class RecordController {
@RequestMapping(value = "/weightExport", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
public void weightExport(@ApiParam @Validated RecordDto.WeightAndRfidExport param, HttpServletResponse response) throws IOException {
log.info("导出智慧平车称重和rfid记录:{}", param);
if (param.getEndTime() != null) {
param.setEndTime(param.getEndTime() + 24 * 3600 *1000);
}
Workbook workbook = recordService.exportWeightAndRfid(param);
log.info("导出智慧平车称重和rfid记录结果结束");
Date start = new Date();

13
wisdomcar/src/main/java/com/ccsens/wisdomcar/service/RecordService.java

@ -169,15 +169,25 @@ public class RecordService implements IRecordService{
Iterator<RecordVo.WeightAndRfid> iterator = list.iterator();
while (iterator.hasNext()) {
RecordVo.WeightAndRfid next = iterator.next();
log.info("next:{}", next);
if (next.getType() == Constant.CAR_RECORD_WEIGHT) {
// 称重
if (weight == null) {
weight = next;
if (rfid != null) {
for (RecordVo.WeightAndRfid vo : list) {
if (vo == next) {
break;
}
vo.setValue(next.getValue());
}
}
continue;
}
// 体重变化和上一条体重相似且间隔时间较短,删除
if (Integer.parseInt(next.getValue()) - Integer.parseInt(weight.getValue()) <= weightMinus && next.getTime() - weight.getTime() <= timeMinus) {
log.info("删除体重,当前:{}, 上一个:{}", next, weight);
iterator.remove();
} else {
weight = next;
@ -193,7 +203,8 @@ public class RecordService implements IRecordService{
}
// rfid和上一个一样且间隔时间较短,删除
if (next.getValue().equals(rfid.getValue()) && next.getTime() - rfid.getTime() <= timeMinus) {
if (next.getName().equals(rfid.getName()) && next.getTime() - rfid.getTime() <= timeMinus) {
log.info("删除rfid,当前rfid:{}, 上一个rfid:{}", next, rfid);
iterator.remove();
} else {
rfid = next;

2
wisdomcar/src/main/resources/mapper_dao/WisdomCarRecordDao.xml

@ -7,7 +7,7 @@
select * from (
select r.time, r.type, r.value, '称重' as name from t_wisdom_car_record r where r.car_id = #{carId} and r.type = 1 and r.time &gt;= #{startTime} and r.time &lt; #{endTime} and r.value &lt;= 200000 and r.rec_status = 0
union
select r.time, r.type, r.value, s.name from t_wisdom_car_record r, t_rfid rfid, t_step s where r.car_id = #{carId} and r.value = rfid.id and rfid.step_id = s.id and r.type = 2 and r.time &gt;= #{startTime} and r.time &lt; #{endTime} and r.rec_status = 0
select r.time, r.type, r.value, s.name from t_wisdom_car_record r, t_rfid rfid, t_step s where r.car_id = #{carId} and r.value = rfid.rfid and rfid.step_id = s.id and r.type = 2 and r.time &gt;= #{startTime} and r.time &lt; #{endTime} and r.rec_status = 0
) t
order by time
</select>

Loading…
Cancel
Save