diff --git a/user-client/src/main/java/com/hp/user/client/entity/AccountVO.java b/user-client/src/main/java/com/hp/user/client/entity/AccountVO.java index 346905a..5512161 100644 --- a/user-client/src/main/java/com/hp/user/client/entity/AccountVO.java +++ b/user-client/src/main/java/com/hp/user/client/entity/AccountVO.java @@ -12,7 +12,7 @@ import java.util.Date; * @since 2020-11-20 */ -public class AccountVO extends BaseVO { +public class AccountVO{ /** * 用户Id */ @@ -29,16 +29,35 @@ public class AccountVO extends BaseVO { * 电话号码 */ private String phone; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public AccountVO(){} - public AccountVO(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long userId, String userName, String wxNumber, String phone) { - super(createTime, createUserId, updateTime, updateUserId); + public AccountVO(Long userId, String userName, String wxNumber, String phone, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.userId = userId; this.userName = userName; this.wxNumber = wxNumber; this.phone = phone; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getUserId() { @@ -72,4 +91,36 @@ public class AccountVO extends BaseVO { public void setPhone(String phone) { this.phone = phone; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-client/src/main/java/com/hp/user/client/entity/AddressVO.java b/user-client/src/main/java/com/hp/user/client/entity/AddressVO.java index 9226867..8bb09c0 100644 --- a/user-client/src/main/java/com/hp/user/client/entity/AddressVO.java +++ b/user-client/src/main/java/com/hp/user/client/entity/AddressVO.java @@ -1,4 +1,5 @@ package com.hp.user.client.entity; +import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -11,7 +12,7 @@ import java.util.Date; * @since 2020-11-20 */ -public class AddressVO extends BaseVO { +public class AddressVO { /** * 地址Id @@ -57,11 +58,26 @@ public class AddressVO extends BaseVO { * 地址标签;0:家;1:公司 */ private Short tag; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public AddressVO(){} - public AddressVO(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long addressId, Long ownerId, String address, String provinceCode, String cityCode, String countCode, String streetCode, BigDecimal longitude, BigDecimal latitude, Short sysDefault, Short tag) { - super(createTime, createUserId, updateTime, updateUserId); + public AddressVO(Long addressId, Long ownerId, String address, String provinceCode, String cityCode, String countCode, String streetCode, BigDecimal longitude, BigDecimal latitude, Short sysDefault, Short tag, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.addressId = addressId; this.ownerId = ownerId; this.address = address; @@ -73,6 +89,10 @@ public class AddressVO extends BaseVO { this.latitude = latitude; this.sysDefault = sysDefault; this.tag = tag; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getAddressId() { @@ -162,4 +182,36 @@ public class AddressVO extends BaseVO { public void setTag(Short tag) { this.tag = tag; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-client/src/main/java/com/hp/user/client/entity/CompanyPageVO.java b/user-client/src/main/java/com/hp/user/client/entity/CompanyPageVO.java new file mode 100644 index 0000000..918c362 --- /dev/null +++ b/user-client/src/main/java/com/hp/user/client/entity/CompanyPageVO.java @@ -0,0 +1,42 @@ +package com.hp.user.client.entity; + +import java.util.List; + +public class CompanyPageVO { + private Long current; // 当前页 + private Integer size; // 当前页size + private Long total; //总条数 + private List companyList; + + public Long getCurrent() { + return current; + } + + public void setCurrent(Long current) { + this.current = current; + } + + public Integer getSize() { + return size; + } + + public void setSize(Integer size) { + this.size = size; + } + + public Long getTotal() { + return total; + } + + public void setTotal(Long total) { + this.total = total; + } + + public List getCompanyList() { + return companyList; + } + + public void setCompanyList(List companyList) { + this.companyList = companyList; + } +} diff --git a/user-client/src/main/java/com/hp/user/client/entity/CustomerCompanyVO.java b/user-client/src/main/java/com/hp/user/client/entity/CustomerCompanyVO.java index a591cbb..69c9b64 100644 --- a/user-client/src/main/java/com/hp/user/client/entity/CustomerCompanyVO.java +++ b/user-client/src/main/java/com/hp/user/client/entity/CustomerCompanyVO.java @@ -11,7 +11,7 @@ import java.util.Date; * @since 2020-11-20 */ -public class CustomerCompanyVO extends BaseVO { +public class CustomerCompanyVO { /** * 客户Id */ @@ -28,6 +28,14 @@ public class CustomerCompanyVO extends BaseVO { * 所属行业编码 */ private Short industryCode; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; /** * 企业税号 */ @@ -44,19 +52,40 @@ public class CustomerCompanyVO extends BaseVO { * 手机号 */ private String phoneNumber; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public CustomerCompanyVO(){} - public CustomerCompanyVO(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long customerId, String name, Short type, Short industryCode, String enterpriseTaxNumber, String businessLicense, String businessContact, String phoneNumber) { - super(createTime, createUserId, updateTime, updateUserId); + public CustomerCompanyVO(Long customerId, String name, Short type, Short industryCode, String longitude, String latitude, String enterpriseTaxNumber, String businessLicense, String businessContact, String phoneNumber, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.customerId = customerId; this.name = name; this.type = type; this.industryCode = industryCode; + this.longitude = longitude; + this.latitude = latitude; this.enterpriseTaxNumber = enterpriseTaxNumber; this.businessLicense = businessLicense; this.businessContact = businessContact; this.phoneNumber = phoneNumber; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getCustomerId() { @@ -91,6 +120,22 @@ public class CustomerCompanyVO extends BaseVO { this.industryCode = industryCode; } + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + public String getEnterpriseTaxNumber() { return enterpriseTaxNumber; } @@ -122,4 +167,36 @@ public class CustomerCompanyVO extends BaseVO { public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-client/src/main/java/com/hp/user/client/entity/StationVO.java b/user-client/src/main/java/com/hp/user/client/entity/StationVO.java index f56e118..62af3f2 100644 --- a/user-client/src/main/java/com/hp/user/client/entity/StationVO.java +++ b/user-client/src/main/java/com/hp/user/client/entity/StationVO.java @@ -11,7 +11,7 @@ import java.util.Date; * @author 王怡静 * @since 2020-11-20 */ -public class StationVO extends BaseVO { +public class StationVO { /** * 站点Id */ @@ -36,17 +36,36 @@ public class StationVO extends BaseVO { * 变压器容量 */ private BigDecimal capacity; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public StationVO(){} - public StationVO(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long stationId, String name, Long enterpriseId, String stationContact, String phone, BigDecimal capacity) { - super(createTime, createUserId, updateTime, updateUserId); + public StationVO(Long stationId, String name, Long enterpriseId, String stationContact, String phone, BigDecimal capacity, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.stationId = stationId; this.name = name; this.enterpriseId = enterpriseId; this.stationContact = stationContact; this.phone = phone; this.capacity = capacity; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getStationId() { @@ -96,4 +115,36 @@ public class StationVO extends BaseVO { public void setCapacity(BigDecimal capacity) { this.capacity = capacity; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-client/src/main/java/com/hp/user/client/service/CustomerCompanyService.java b/user-client/src/main/java/com/hp/user/client/service/CustomerCompanyService.java index 6de3df8..6f633b0 100644 --- a/user-client/src/main/java/com/hp/user/client/service/CustomerCompanyService.java +++ b/user-client/src/main/java/com/hp/user/client/service/CustomerCompanyService.java @@ -1,9 +1,8 @@ package com.hp.user.client.service; +import com.hp.user.client.entity.CompanyPageVO; import com.hp.user.client.entity.CustomerCompanyVO; -import java.util.List; - /** *

* 企业/公司 服务类 @@ -17,6 +16,6 @@ public interface CustomerCompanyService { public boolean delete(Long companyId); public boolean update(CustomerCompanyVO company); public CustomerCompanyVO queryCompanyByCompanyId(Long companyId); - public List queryAllCompany(); - + public CompanyPageVO getCompanysPage(Long current, Integer size); + public CompanyPageVO queryCompanyspageByNameAndServiceAndStatus(String name,String serviceProviderName,Integer status,Long current, Integer size); } diff --git a/user-service/src/main/java/com/hp/user/service/config/MyBatisPlusConfig.java b/user-service/src/main/java/com/hp/user/service/config/MyBatisPlusConfig.java new file mode 100644 index 0000000..2b0a0e5 --- /dev/null +++ b/user-service/src/main/java/com/hp/user/service/config/MyBatisPlusConfig.java @@ -0,0 +1,20 @@ +package com.hp.user.service.config; + +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.transaction.annotation.EnableTransactionManagement; + +@EnableTransactionManagement +@Configuration +@MapperScan("com.hp.user.service.dao") //扫描的mapper +public class MyBatisPlusConfig { + /** + * 分页插件 + */ + @Bean + public PaginationInterceptor paginationInterceptor() { + return new PaginationInterceptor(); + } +} \ No newline at end of file diff --git a/user-service/src/main/java/com/hp/user/service/controller/CompanyController.java b/user-service/src/main/java/com/hp/user/service/controller/CompanyController.java index 243a136..da7d4d5 100644 --- a/user-service/src/main/java/com/hp/user/service/controller/CompanyController.java +++ b/user-service/src/main/java/com/hp/user/service/controller/CompanyController.java @@ -1,26 +1,35 @@ package com.hp.user.service.controller; +import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; +import com.hp.user.client.entity.CompanyPageVO; import com.hp.user.client.entity.CustomerCompanyVO; import com.hp.user.client.service.CustomerCompanyService; +import com.hp.user.util.IdWorker; import com.hp.user.utils.HttpResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; import org.springframework.web.bind.annotation.*; +import java.util.List; + @Api(tags = "企业/服务商API接口") @RestController @RequestMapping("/company") public class CompanyController { @Autowired private CustomerCompanyService customerCompanyService; + /** * 添加企业 + * @param company 企业信息 + * @return HttpResult */ @ApiOperation(value = "新增企业", notes = "新增企业", httpMethod = "POST") @PostMapping("/addCompany") public HttpResult addCompany(@RequestBody CustomerCompanyVO company){ - company.setCustomerId(123L); + company.setCustomerId(IdWorker.generactorId()); boolean flag=customerCompanyService.insert(company); if(flag) return HttpResult.success(company.getCustomerId()); else return HttpResult.fail(); @@ -28,6 +37,8 @@ public class CompanyController { /** * 更新企业信息 + * @param company 企业信息 + * @return HttpResult */ @ApiOperation(value = "更新企业信息", notes = "更新企业信息", httpMethod = "POST") @PostMapping("/updateCompany") @@ -40,6 +51,7 @@ public class CompanyController { /** * 根据企业Id删除企业 * @param companyId 企业Id + * @return HttpResult */ @ApiOperation(value = "删除企业", notes = "删除企业", httpMethod = "GET") @GetMapping("/deleteCompanyByCompanyId") @@ -52,6 +64,7 @@ public class CompanyController { /** * 根据企业Id查询某企业信息 * @param companyId 企业Id + * @return CustomerCompanyVO */ @ApiOperation(value="根据企业Id查询某企业信息") @GetMapping("/queryCompanyByCompanyId") @@ -60,11 +73,30 @@ public class CompanyController { } /** - * 查询所有企业基本信息 + * 分页查询所有企业信息 + * @param current 要查询页数 + * @param size 一页的行数 + * @return CompanyPageVO */ - @GetMapping("/queryAllCompany") - public void queryAllCompany(){ + @ApiOperation(value="分页查询所有企业",notes="输入的current为要查询的页数,size为一页的行数,返回的total为总行数") + @GetMapping("/queryAllCompanyByPage") + public CompanyPageVO queryAllCompanyByPage(@RequestParam Long current, @RequestParam Integer size){ + return customerCompanyService.getCompanysPage(current,size); + } + /** + * 分页查询符合条件的企业信息 + * @param name 企业名称 + * @param serviceProviderName 企业关联服务商名称 + * @param status 审核状态 + * @param current 要查询页数 + * @param size 一页的行数 + * @return CompanyPageVO + */ + @ApiOperation(value="根据企业姓名、关联服务商、审核状态分页查询企业",notes="若查询服务商,则只需要填name,serviceProviderName为空,status为0") + @GetMapping("/queryCompanysPageByNameAndServiceProviderAndStatus") + public CompanyPageVO queryCompanysPageByNameAndServiceProviderAndStatus(String name,String serviceProviderName,@RequestParam Integer status,@RequestParam Long current,@RequestParam Integer size){ + return customerCompanyService.queryCompanyspageByNameAndServiceAndStatus(name,serviceProviderName,status,current,size); } /** diff --git a/user-service/src/main/java/com/hp/user/service/entity/Account.java b/user-service/src/main/java/com/hp/user/service/entity/Account.java index 0b79592..2325bcf 100644 --- a/user-service/src/main/java/com/hp/user/service/entity/Account.java +++ b/user-service/src/main/java/com/hp/user/service/entity/Account.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; import java.util.Date; @@ -19,7 +20,7 @@ import java.util.Date; //@EqualsAndHashCode(callSuper = false) //@Accessors(chain = true) @TableName("tb_account") -public class Account extends Base{ +public class Account implements Serializable { /** * 用户Id */ @@ -37,16 +38,34 @@ public class Account extends Base{ * 电话号码 */ private String phone; - + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public Account(){} - public Account(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long userId, String userName, String wxNumber, String phone) { - super(createTime, createUserId, updateTime, updateUserId); + public Account(Long userId, String userName, String wxNumber, String phone, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.userId = userId; this.userName = userName; this.wxNumber = wxNumber; this.phone = phone; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getUserId() { @@ -80,4 +99,36 @@ public class Account extends Base{ public void setPhone(String phone) { this.phone = phone; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-service/src/main/java/com/hp/user/service/entity/Address.java b/user-service/src/main/java/com/hp/user/service/entity/Address.java index bfd5499..d4acf2b 100644 --- a/user-service/src/main/java/com/hp/user/service/entity/Address.java +++ b/user-service/src/main/java/com/hp/user/service/entity/Address.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -19,7 +20,7 @@ import java.util.Date; //@EqualsAndHashCode(callSuper = false) //@Accessors(chain = true) @TableName("tb_address") -public class Address extends Base{ +public class Address implements Serializable { /** * 地址Id @@ -66,11 +67,26 @@ public class Address extends Base{ * 地址标签;0:家;1:公司 */ private Short tag; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public Address(){} - public Address(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long addressId, Long ownerId, String address, String provinceCode, String cityCode, String countCode, String streetCode, BigDecimal longitude, BigDecimal latitude, Short sysDefault, Short tag) { - super(createTime, createUserId, updateTime, updateUserId); + public Address(Long addressId, Long ownerId, String address, String provinceCode, String cityCode, String countCode, String streetCode, BigDecimal longitude, BigDecimal latitude, Short sysDefault, Short tag, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.addressId = addressId; this.ownerId = ownerId; this.address = address; @@ -82,6 +98,10 @@ public class Address extends Base{ this.latitude = latitude; this.sysDefault = sysDefault; this.tag = tag; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getAddressId() { @@ -171,4 +191,36 @@ public class Address extends Base{ public void setTag(Short tag) { this.tag = tag; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-service/src/main/java/com/hp/user/service/entity/Base.java b/user-service/src/main/java/com/hp/user/service/entity/Base.java index 53c7aa2..3888b3c 100644 --- a/user-service/src/main/java/com/hp/user/service/entity/Base.java +++ b/user-service/src/main/java/com/hp/user/service/entity/Base.java @@ -16,7 +16,7 @@ public class Base implements Serializable { /** * 创建用户Id */ - private Long sysCreateUserId; + private Long sysCreator; /** * 更新时间 */ @@ -24,17 +24,17 @@ public class Base implements Serializable { /** * 更新用户Id */ - private Long syspdateUserId; + private Long sysUpdater; public Base(){ } - public Base(Date sysCreateTime, Long sysCreateUserId, Date sysUpdateTime, Long syspdateUserId) { + public Base(Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long syspdator) { this.sysCreateTime = sysCreateTime; - this.sysCreateUserId = sysCreateUserId; + this.sysCreator = sysCreator; this.sysUpdateTime = sysUpdateTime; - this.syspdateUserId = syspdateUserId; + this.sysUpdater = syspdator; } public Date getSysCreateTime() { @@ -45,12 +45,12 @@ public class Base implements Serializable { this.sysCreateTime = sysCreateTime; } - public Long getSysCreateUserId() { - return sysCreateUserId; + public Long getSysCreator() { + return sysCreator; } - public void setSysCreateUserId(Long sysCreateUserId) { - this.sysCreateUserId = sysCreateUserId; + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; } public Date getSysUpdateTime() { @@ -61,11 +61,11 @@ public class Base implements Serializable { this.sysUpdateTime = sysUpdateTime; } - public Long getSyspdateUserId() { - return syspdateUserId; + public Long getSysUpdater() { + return sysUpdater; } - public void setSyspdateUserId(Long syspdateUserId) { - this.syspdateUserId = syspdateUserId; + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; } } diff --git a/user-service/src/main/java/com/hp/user/service/entity/CustomerCompany.java b/user-service/src/main/java/com/hp/user/service/entity/CustomerCompany.java index 132e6d9..c16ab72 100644 --- a/user-service/src/main/java/com/hp/user/service/entity/CustomerCompany.java +++ b/user-service/src/main/java/com/hp/user/service/entity/CustomerCompany.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; import java.util.Date; /** @@ -18,7 +19,7 @@ import java.util.Date; //@EqualsAndHashCode(callSuper = false) //@Accessors(chain = true) @TableName("tb_customer_company") -public class CustomerCompany extends Base { +public class CustomerCompany implements Serializable { /** * 客户Id */ @@ -36,6 +37,14 @@ public class CustomerCompany extends Base { * 所属行业编码 */ private Short industryCode; + /** + * 经度 + */ + private String longitude; + /** + * 纬度 + */ + private String latitude; /** * 企业税号 */ @@ -52,19 +61,40 @@ public class CustomerCompany extends Base { * 手机号 */ private String phoneNumber; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; public CustomerCompany(){} - public CustomerCompany(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long customerId, String name, Short type, Short industryCode, String enterpriseTaxNumber, String businessLicense, String businessContact, String phoneNumber) { - super(createTime, createUserId, updateTime, updateUserId); + public CustomerCompany(Long customerId, String name, Short type, Short industryCode, String longitude, String latitude, String enterpriseTaxNumber, String businessLicense, String businessContact, String phoneNumber, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.customerId = customerId; this.name = name; this.type = type; this.industryCode = industryCode; + this.longitude = longitude; + this.latitude = latitude; this.enterpriseTaxNumber = enterpriseTaxNumber; this.businessLicense = businessLicense; this.businessContact = businessContact; this.phoneNumber = phoneNumber; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getCustomerId() { @@ -99,6 +129,22 @@ public class CustomerCompany extends Base { this.industryCode = industryCode; } + public String getLongitude() { + return longitude; + } + + public void setLongitude(String longitude) { + this.longitude = longitude; + } + + public String getLatitude() { + return latitude; + } + + public void setLatitude(String latitude) { + this.latitude = latitude; + } + public String getEnterpriseTaxNumber() { return enterpriseTaxNumber; } @@ -130,4 +176,36 @@ public class CustomerCompany extends Base { public void setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-service/src/main/java/com/hp/user/service/entity/Station.java b/user-service/src/main/java/com/hp/user/service/entity/Station.java index aa7bb2c..d11befe 100644 --- a/user-service/src/main/java/com/hp/user/service/entity/Station.java +++ b/user-service/src/main/java/com/hp/user/service/entity/Station.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; +import java.io.Serializable; import java.math.BigDecimal; import java.util.Date; @@ -19,7 +20,7 @@ import java.util.Date; //@EqualsAndHashCode(callSuper = false) //@Accessors(chain = true) @TableName("tb_station") -public class Station extends Base{ +public class Station implements Serializable { /** * 站点Id */ @@ -46,16 +47,36 @@ public class Station extends Base{ */ private BigDecimal capacity; + /** + * 创建时间 + */ + private Date sysCreateTime; + /** + * 创建用户Id + */ + private Long sysCreator; + /** + * 更新时间 + */ + private Date sysUpdateTime; + /** + * 更新用户Id + */ + private Long sysUpdater; + public Station(){} - public Station(Date createTime, Long createUserId, Date updateTime, Long updateUserId, Long stationId, String name, Long enterpriseId, String stationContact, String phone, BigDecimal capacity) { - super(createTime, createUserId, updateTime, updateUserId); + public Station(Long stationId, String name, Long enterpriseId, String stationContact, String phone, BigDecimal capacity, Date sysCreateTime, Long sysCreator, Date sysUpdateTime, Long sysUpdater) { this.stationId = stationId; this.name = name; this.enterpriseId = enterpriseId; this.stationContact = stationContact; this.phone = phone; this.capacity = capacity; + this.sysCreateTime = sysCreateTime; + this.sysCreator = sysCreator; + this.sysUpdateTime = sysUpdateTime; + this.sysUpdater = sysUpdater; } public Long getStationId() { @@ -105,4 +126,36 @@ public class Station extends Base{ public void setCapacity(BigDecimal capacity) { this.capacity = capacity; } + + public Date getSysCreateTime() { + return sysCreateTime; + } + + public void setSysCreateTime(Date sysCreateTime) { + this.sysCreateTime = sysCreateTime; + } + + public Long getSysCreator() { + return sysCreator; + } + + public void setSysCreator(Long sysCreator) { + this.sysCreator = sysCreator; + } + + public Date getSysUpdateTime() { + return sysUpdateTime; + } + + public void setSysUpdateTime(Date sysUpdateTime) { + this.sysUpdateTime = sysUpdateTime; + } + + public Long getSysUpdater() { + return sysUpdater; + } + + public void setSysUpdater(Long sysUpdater) { + this.sysUpdater = sysUpdater; + } } diff --git a/user-service/src/main/java/com/hp/user/service/impl/CustomerCompanyServiceImpl.java b/user-service/src/main/java/com/hp/user/service/impl/CustomerCompanyServiceImpl.java index ee154cc..c17f5c1 100644 --- a/user-service/src/main/java/com/hp/user/service/impl/CustomerCompanyServiceImpl.java +++ b/user-service/src/main/java/com/hp/user/service/impl/CustomerCompanyServiceImpl.java @@ -1,14 +1,24 @@ package com.hp.user.service.impl; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; +import com.hp.user.client.entity.AreaVO; +import com.hp.user.client.entity.CompanyPageVO; import com.hp.user.client.entity.CustomerCompanyVO; import com.hp.user.client.service.CustomerCompanyService; +import com.hp.user.service.controller.CompanyController; import com.hp.user.service.dao.CustomerCompanyMapper; +import com.hp.user.service.dao.CustomerServiceProviderEnterpriseMapper; import com.hp.user.service.entity.CustomerCompany; +import com.hp.user.service.entity.CustomerServiceProviderEnterprise; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.util.StringUtils; +import java.util.ArrayList; import java.util.List; /** @@ -23,6 +33,9 @@ import java.util.List; public class CustomerCompanyServiceImpl implements CustomerCompanyService { @Autowired private CustomerCompanyMapper customerCompanyMapper; + @Autowired + private CustomerServiceProviderEnterpriseMapper customerServiceProviderEnterpriseMapper; + @Override public boolean insert(CustomerCompanyVO company) { CustomerCompany temp=new CustomerCompany(); @@ -47,11 +60,75 @@ public class CustomerCompanyServiceImpl implements CustomerCompanyService { @Override public CustomerCompanyVO queryCompanyByCompanyId(Long companyId) { - return null; + CustomerCompanyVO customerCompanyVO = new CustomerCompanyVO(); + CustomerCompany temp = customerCompanyMapper.selectById(companyId); + BeanUtils.copyProperties(temp,customerCompanyVO); + return customerCompanyVO; + } + + @Override + public CompanyPageVO getCompanysPage(Long current, Integer size) { + CompanyPageVO companyPageVO = new CompanyPageVO(); + List companyVOs=new ArrayList<>(); + IPage page = new Page<>(current,size); + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.orderByDesc("sys_create_time"); + customerCompanyMapper.selectPage(page,queryWrapper); + List companys = page.getRecords(); + CustomerCompanyVO temp; + for(CustomerCompany company:companys){ + temp=new CustomerCompanyVO(); + BeanUtils.copyProperties(company,temp); + companyVOs.add(temp); + } + companyPageVO.setCompanyList(companyVOs); + companyPageVO.setTotal(page.getTotal()); + companyPageVO.setCurrent(current); + companyPageVO.setSize(size); + return companyPageVO; } @Override - public List queryAllCompany() { - return null; + public CompanyPageVO queryCompanyspageByNameAndServiceAndStatus(String name, String serviceProviderName, Integer status,Long current, Integer size) { + CompanyPageVO companyPageVO = new CompanyPageVO(); + List companyVOs=new ArrayList<>(); + IPage page = new Page<>(current,size); + QueryWrapper wrapper = new QueryWrapper<>(); + // 关联服务商 + if (!StringUtils.isEmpty(serviceProviderName)){ + QueryWrapper queryWrapper = new QueryWrapper<>(); + // 先查出服务商信息,再根据服务商Id与企业Id的对应情况查企业 + queryWrapper.like("name",serviceProviderName); + Long serviceProviderId = customerCompanyMapper.selectOne(queryWrapper).getCustomerId(); + //根据服务商Id与企业Id的对应情况查企业Id + QueryWrapper tempWrapper = new QueryWrapper<>(); + tempWrapper.eq("service_provider_id",serviceProviderId); + List temp = customerServiceProviderEnterpriseMapper.selectList(tempWrapper); + List companyIds =new ArrayList<>(); + for(CustomerServiceProviderEnterprise tt:temp){ + companyIds.add(tt.getEnterpriseId()); + } + wrapper.in("customer_id",companyIds); + } + if(status!=0){ + wrapper.eq("status",status); + } + if(!StringUtils.isEmpty(name)){ + wrapper.like("name",name); + } + wrapper.orderByDesc("sys_create_time"); + customerCompanyMapper.selectPage(page,wrapper); + List companys = page.getRecords(); + CustomerCompanyVO t; + for(CustomerCompany company:companys){ + t=new CustomerCompanyVO(); + BeanUtils.copyProperties(company,t); + companyVOs.add(t); + } + companyPageVO.setCompanyList(companyVOs); + companyPageVO.setTotal(page.getTotal()); + companyPageVO.setCurrent(current); + companyPageVO.setSize(size); + return companyPageVO; } }