Commit 19bb3114 authored by tianbo's avatar tianbo

气瓶列表查询

parent c3688f8c
......@@ -54,6 +54,6 @@ public class SpecialEquipmentDto {
@ApiModelProperty(value = "内部编码")
private String innerNum;
@ApiModelProperty(value = "设备唯一编码")
private String uniqueCode;
@ApiModelProperty(value = "产权单位")
private String unitName;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 气瓶终端用户
*
* @author system_generator
* @date 2022-04-21
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="EndUserDto", description="气瓶终端用户")
public class EndUserDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "客户编号")
private String customCode;
@ApiModelProperty(value = "客户名称")
private String customName;
@ApiModelProperty(value = "客户类型")
private String customType;
@ApiModelProperty(value = "开户类型")
private String accountType;
@ApiModelProperty(value = "联系人")
private String contact;
@ApiModelProperty(value = "联系电话")
private String contactPhone;
@ApiModelProperty(value = "客户地址")
private String address;
@ApiModelProperty(value = "充装单位")
private String fillingUnit;
@ApiModelProperty(value = "所属机构")
private String affiliation;
@ApiModelProperty(value = "上次下单时间")
private Date lastOrderDate;
@ApiModelProperty(value = "配送员")
private String delivery;
@ApiModelProperty(value = "配送员电话")
private String deliveryPhone;
@ApiModelProperty(value = "钢瓶码")
private String cylinderCode;
@ApiModelProperty(value = "芯片号")
private String chipCode;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "纬度")
private String latitude;
}
......@@ -181,4 +181,10 @@ public class CylinderInfo {
*/
@TableField("latitude")
private String latitude;
/**
* 最近气瓶使用客户编号
*/
@TableField("end_custom_code")
private String endCustomCode;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* 气瓶终端用户
*
* @author system_generator
* @date 2022-04-21
*/
@Data
@EqualsAndHashCode()
@Accessors(chain = true)
@TableName("tz_end_user")
public class EndUser {
private static final long serialVersionUID = 1L;
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
protected Long sequenceNbr;
@TableField(value = "rec_date", fill = FieldFill.INSERT_UPDATE)
protected Date recDate;
@TableField(value = "rec_user_id", fill = FieldFill.INSERT_UPDATE)
protected String recUserId;
/**
* 客户编号
*/
@TableField("custom_code")
private String customCode;
/**
* 客户名称
*/
@TableField("custom_name")
private String customName;
/**
* 客户类型
*/
@TableField("custom_type")
private String customType;
/**
* 开户类型
*/
@TableField("account_type")
private String accountType;
/**
* 联系人
*/
@TableField("contact")
private String contact;
/**
* 联系电话
*/
@TableField("contact_phone")
private String contactPhone;
/**
* 客户地址
*/
@TableField("address")
private String address;
/**
* 充装单位
*/
@TableField("filling_unit")
private String fillingUnit;
/**
* 所属机构
*/
@TableField("affiliation")
private String affiliation;
/**
* 上次下单时间
*/
@TableField("last_order_date")
private Date lastOrderDate;
/**
* 配送员
*/
@TableField("delivery")
private String delivery;
/**
* 配送员电话
*/
@TableField("delivery_phone")
private String deliveryPhone;
/**
* 钢瓶码
*/
@TableField("cylinder_code")
private String cylinderCode;
/**
* 芯片号
*/
@TableField("chip_code")
private String chipCode;
/**
* 经度
*/
@TableField("longitude")
private String longitude;
/**
* 纬度
*/
@TableField("latitude")
private String latitude;
}
package com.yeejoin.amos.boot.module.tzs.flc.api.mapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 气瓶终端用户 Mapper 接口
*
* @author system_generator
* @date 2022-04-21
*/
public interface EndUserMapper extends BaseMapper<EndUser> {
}
package com.yeejoin.amos.boot.module.tzs.flc.api.service;
/**
* 气瓶终端用户接口类
*
* @author system_generator
* @date 2022-04-21
*/
public interface IEndUserService {
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EndUserMapper">
</mapper>
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.tzs.api.dto.EsSpecialEquipmentDto;
......@@ -9,6 +10,8 @@ import com.yeejoin.amos.boot.module.tzs.api.entity.EsCylinder;
import com.yeejoin.amos.boot.module.tzs.api.enums.SpecialEquipmentCategoryEnum;
import com.yeejoin.amos.boot.module.tzs.biz.dao.ESCylinderRepository;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.CylinderInfo;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EndUserServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.elasticsearch.common.geo.GeoPoint;
import org.elasticsearch.index.query.BoolQueryBuilder;
......@@ -44,6 +47,9 @@ public class ESCylinderServiceImpl {
@Autowired
private ESCylinderRepository esCylinderRepository;
@Autowired
private EndUserServiceImpl endUserService;
/**
* <pre>
* 保存气瓶信息
......@@ -63,7 +69,11 @@ public class ESCylinderServiceImpl {
esCylinder.setLatitude(Double.parseDouble(cylinderInfo.getLatitude()));
}
esCylinder.setSequenceNbr(cylinderInfo.getSequenceNbr());
// esCylinder.setAddress(cylinder.getAddress());
EndUser endUser = endUserService.getOne(new LambdaQueryWrapper<EndUser>().eq(EndUser::getCustomCode,
cylinderInfo.getEndCustomCode()));
if (!ValidationUtil.isEmpty(endUser)) {
esCylinder.setAddress(endUser.getAddress());
}
esCylinder.setFactoryNum(cylinderInfo.getFactoryNum());
esCylinder.setUnitName(cylinderInfo.getUnitName());
if (StringUtils.isNotBlank(cylinderInfo.getLatitude()) && StringUtils.isNotBlank(cylinderInfo.getLongitude())) {
......@@ -138,7 +148,8 @@ public class ESCylinderServiceImpl {
JSONObject jsonObject = (JSONObject) JSONObject.toJSON(searchHit.getContent());
SpecialEquipmentDto esCylinderDto = JSONObject.toJavaObject(jsonObject, SpecialEquipmentDto.class);
esCylinderDto.setCategoryCode(SpecialEquipmentCategoryEnum.PRESSURE_VESSEL.getCode());
esCylinderDto.setUniqueCode(jsonObject.getString("factoryNum"));
esCylinderDto.setUnitName(jsonObject.getString("unitName"));
esCylinderDto.setRegisterCode(jsonObject.getString("factoryNum"));
list.add(esCylinderDto);
}
total = searchHits.getTotalHits();
......
......@@ -923,7 +923,7 @@ public class CylinderInfoController extends BaseController {
times = num;
}
for (int i = 0; i <= times; i++) {
for (int i = 0; i < times; i++) {
cylinderInfoPage.setCurrent(i);
cylinderInfoPage.setSize(500);
cylinderInfoPage = cylinderInfoServiceImpl.page(cylinderInfoPage);
......
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl.EndUserServiceImpl;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EndUserDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
/**
* 气瓶终端用户
*
* @author system_generator
* @date 2022-04-21
*/
@RestController
@Api(tags = "气瓶终端用户Api")
@RequestMapping(value = "/end-user")
public class EndUserController extends BaseController {
@Autowired
EndUserServiceImpl endUserServiceImpl;
/**
* 新增气瓶终端用户
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增气瓶终端用户", notes = "新增气瓶终端用户")
public ResponseModel<EndUserDto> save(@RequestBody EndUserDto model) {
model = endUserServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model);
}
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新气瓶终端用户", notes = "根据sequenceNbr更新气瓶终端用户")
public ResponseModel<EndUserDto> updateBySequenceNbrEndUser(@RequestBody EndUserDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(endUserServiceImpl.updateWithModel(model));
}
/**
* 根据sequenceNbr删除
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除气瓶终端用户", notes = "根据sequenceNbr删除气瓶终端用户")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(endUserServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个气瓶终端用户", notes = "根据sequenceNbr查询单个气瓶终端用户")
public ResponseModel<EndUserDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(endUserServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "气瓶终端用户分页查询", notes = "气瓶终端用户分页查询")
public ResponseModel<Page<EndUserDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EndUserDto> page = new Page<EndUserDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(endUserServiceImpl.queryForEndUserPage(page));
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "气瓶终端用户列表全部数据查询", notes = "气瓶终端用户列表全部数据查询")
@GetMapping(value = "/list")
public ResponseModel<List<EndUserDto>> selectForList() {
return ResponseHelper.buildResponse(endUserServiceImpl.queryForEndUserList());
}
}
package com.yeejoin.amos.boot.module.tzs.flc.biz.service.impl;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EndUser;
import com.yeejoin.amos.boot.module.tzs.flc.api.mapper.EndUserMapper;
import com.yeejoin.amos.boot.module.tzs.flc.api.service.IEndUserService;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EndUserDto;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* 气瓶终端用户服务实现类
*
* @author system_generator
* @date 2022-04-21
*/
@Service
public class EndUserServiceImpl extends BaseService<EndUserDto,EndUser,EndUserMapper> implements IEndUserService {
/**
* 分页查询
*/
public Page<EndUserDto> queryForEndUserPage(Page<EndUserDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<EndUserDto> queryForEndUserList() {
return this.queryForList("" , false);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment