上级平台管理;服务平台管理

dev
dengchengming 2025-07-15 10:40:40 +08:00
parent 60a3cd8bff
commit adbaf72d32
45 changed files with 1739 additions and 27 deletions

View File

@ -73,5 +73,8 @@ public class Const {
*/
public static final String DATA_SOURCE_PARENT_ID = "18a4881b07d4bdae8c744b3b071c6c7c";
/**
* id
*/
public static final String AREA_PARENT_ID = "e725d2a91b8248f4b8f49889038df7de";
}

View File

@ -0,0 +1,71 @@
package com.zcloud.modules.corp.controller;
import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import com.zcloud.modules.corp.dto.req.CompanyInfoReqDto;
import com.zcloud.modules.corp.dto.req.CompanyQueryDto;
import com.zcloud.modules.corp.dto.req.ServicePlatformQueryDto;
import com.zcloud.modules.corp.dto.req.ServicePlatformReqDto;
import com.zcloud.modules.corp.dto.res.CompanyInfoResDto;
import com.zcloud.modules.corp.dto.res.ServicePlatformResDto;
import com.zcloud.modules.corp.service.BusCompanyInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
*
*
* @author dengchengming
* @since 2025-07-14 09:58:07
*/
@RestController
@RequestMapping("/busCompanyInfo")
public class BusCompanyInfoController {
@Autowired
private BusCompanyInfoService companyInfoService;
@SysLog("对接企业管理-分页查询")
@PostMapping("/listPage")
public R listPage(@RequestBody CompanyQueryDto req) {
PageUtils page = companyInfoService.queryPage(req);
return R.ok().put("page", page);
}
@SysLog("对接企业管理-新增")
@PostMapping("/save")
public R save(@RequestBody @Validated(AddGroup.class) CompanyInfoReqDto req) {
companyInfoService.save(req);
return R.ok();
}
@SysLog("对接企业管理-详情")
@PostMapping("/detail")
public R detail(@RequestBody @Validated(DeleteGroup.class) CompanyInfoReqDto req) {
CompanyInfoResDto res = companyInfoService.detail(req);
return R.ok().put("data", res);
}
@SysLog("对接企业管理-修改")
@PostMapping("/update")
public R update(@RequestBody @Validated(UpdateGroup.class) CompanyInfoReqDto req) {
companyInfoService.updateById(req);
return R.ok();
}
@SysLog("对接企业管理-删除")
@PostMapping("/delete")
public R delete(@RequestBody @Validated(DeleteGroup.class) CompanyInfoReqDto req) {
companyInfoService.deleteById(req);
return R.ok();
}
}

View File

@ -0,0 +1,78 @@
package com.zcloud.modules.corp.controller;
import com.zcloud.common.annotation.SysLog;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.R;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import com.zcloud.modules.corp.dto.req.ServicePlatformQueryDto;
import com.zcloud.modules.corp.dto.req.ServicePlatformReqDto;
import com.zcloud.modules.corp.dto.res.ServicePlatformResDto;
import com.zcloud.modules.corp.dto.res.ThirdPlatformResDto;
import com.zcloud.modules.corp.service.BusServicePlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
*
* @author dengchengming
* @since 2025-07-14 08:31:32
*/
@RestController
@RequestMapping("/busServicePlatform")
public class BusServicePlatformController {
@Autowired
private BusServicePlatformService busServicePlatformService;
@SysLog("服务平台管理-分页查询")
@PostMapping("/listPage")
public R listPage(@RequestBody ServicePlatformQueryDto req) {
PageUtils page = busServicePlatformService.queryPage(req);
return R.ok().put("page", page);
}
@SysLog("服务平台管理-所有")
@PostMapping("/listAll")
public R listAll(){
List<ServicePlatformResDto> all = busServicePlatformService.listAll();
return R.ok().put("data", all);
}
@SysLog("服务平台管理-新增")
@PostMapping("/save")
public R save(@RequestBody @Validated(AddGroup.class) ServicePlatformReqDto req) {
busServicePlatformService.save(req);
return R.ok();
}
@SysLog("服务平台管理-详情")
@PostMapping("/detail")
public R detail(@RequestBody @Validated(DeleteGroup.class) ServicePlatformReqDto req) {
ServicePlatformResDto res = busServicePlatformService.detail(req);
return R.ok().put("data", res);
}
@SysLog("服务平台管理-修改")
@PostMapping("/update")
public R update(@RequestBody @Validated(UpdateGroup.class) ServicePlatformReqDto req) {
busServicePlatformService.updateById(req);
return R.ok();
}
@SysLog("服务平台管理-删除")
@PostMapping("/delete")
public R delete(@RequestBody @Validated(DeleteGroup.class) ServicePlatformReqDto req) {
busServicePlatformService.deleteById(req);
return R.ok();
}
}

View File

@ -9,7 +9,6 @@ import com.zcloud.common.validator.group.UpdateGroup;
import com.zcloud.modules.corp.dto.req.DataSaveReqDto;
import com.zcloud.modules.corp.dto.req.ThirdPlatformQueryDto;
import com.zcloud.modules.corp.dto.req.ThirdPlatformReqDto;
import com.zcloud.modules.corp.dto.res.DataDetailResDto;
import com.zcloud.modules.corp.dto.res.ThirdPlatformResDto;
import com.zcloud.modules.corp.service.BusThirdDataItemsRelationService;
import com.zcloud.modules.corp.service.BusThirdPlatformService;
@ -20,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
*
@ -39,13 +40,20 @@ public class BusThirdPlatformController {
/**
*
*/
@PostMapping("/listPage")
@SysLog("上级平台信息-分页查询")
@PostMapping("/listPage")
public R listPage(@RequestBody ThirdPlatformQueryDto req){
PageUtils page = busThirdPlatformService.queryPage(req);
return R.ok().put("page", page);
}
@SysLog("上级平台信息-所有")
@PostMapping("/listAll")
public R listAll(){
List<ThirdPlatformResDto> all = busThirdPlatformService.listAll();
return R.ok().put("data", all);
}
@SysLog("上级平台信息-新增")
@PostMapping("/save")
public R save(@RequestBody @Validated(AddGroup.class) ThirdPlatformReqDto req) {

View File

@ -1,7 +1,11 @@
package com.zcloud.modules.corp.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcloud.modules.corp.dto.req.CompanyQueryDto;
import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (BusCompanyInfo)访
@ -11,5 +15,9 @@ import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
*/
public interface BusCompanyInfoDao extends BaseMapper<BusCompanyInfoEntity> {
List<BusCompanyInfoEntity> selectPage(@Param("req") CompanyQueryDto req, @Param("offset") int offset, @Param("limit") int limit);
int selectCount(@Param("req") CompanyQueryDto req);
}

View File

@ -3,6 +3,8 @@ package com.zcloud.modules.corp.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
import java.util.List;
/**
* (BusCompanyThirdRelation)访
*
@ -11,5 +13,9 @@ import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
*/
public interface BusCompanyThirdRelationDao extends BaseMapper<BusCompanyThirdRelationEntity> {
void insertList(List<BusCompanyThirdRelationEntity> list);
void delByCondition(BusCompanyThirdRelationEntity del);
}

View File

@ -1,7 +1,11 @@
package com.zcloud.modules.corp.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zcloud.modules.corp.dto.req.ServicePlatformQueryDto;
import com.zcloud.modules.corp.entity.BusServicePlatformEntity;
import org.apache.ibatis.annotations.Param;
/**
* (BusServicePlatform)访
@ -11,5 +15,7 @@ import com.zcloud.modules.corp.entity.BusServicePlatformEntity;
*/
public interface BusServicePlatformDao extends BaseMapper<BusServicePlatformEntity> {
IPage<BusServicePlatformEntity> selectPage(Page<BusServicePlatformEntity> page, @Param("req") ServicePlatformQueryDto req);
}

View File

@ -3,6 +3,8 @@ package com.zcloud.modules.corp.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcloud.modules.corp.entity.BusServiceThirdRelationEntity;
import java.util.List;
/**
* (BusServiceThirdRelation)访
*
@ -11,5 +13,9 @@ import com.zcloud.modules.corp.entity.BusServiceThirdRelationEntity;
*/
public interface BusServiceThirdRelationDao extends BaseMapper<BusServiceThirdRelationEntity> {
void insertList(List<BusServiceThirdRelationEntity> list);
void delByCondition(BusServiceThirdRelationEntity del);
}

View File

@ -15,6 +15,6 @@ public interface BusThirdDataItemsRelationDao extends BaseMapper<BusThirdDataIte
void insertList(List<BusThirdDataItemsRelationEntity> entityList);
void updateByCondition(BusThirdDataItemsRelationEntity entity);
void delByCondition(BusThirdDataItemsRelationEntity entity);
}

View File

@ -3,6 +3,8 @@ package com.zcloud.modules.corp.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zcloud.modules.corp.entity.BusThirdPlatformEntity;
import java.util.List;
/**
* (BusThirdPlatform)访
*
@ -11,5 +13,7 @@ import com.zcloud.modules.corp.entity.BusThirdPlatformEntity;
*/
public interface BusThirdPlatformDao extends BaseMapper<BusThirdPlatformEntity> {
List<BusThirdPlatformEntity> getByServiceId(Integer serviceId);
}

View File

@ -0,0 +1,145 @@
package com.zcloud.modules.corp.dto.req;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* req
*
* @author dengchengming
* @since 2025-07-14 15:07:01
*/
@Data
public class CompanyInfoReqDto {
@NotNull(message = "id不能为空", groups = {UpdateGroup.class, DeleteGroup.class})
private Integer id;
/**
*
*/
@NotBlank(message = "企业名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String companyName;
/**
*
*/
@NotBlank(message = "企业编码不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String companyCode;
/**
*
*/
@NotBlank(message = "所属行业不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String sector;
/**
* id
*/
@NotNull(message = "服务平台不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer servicePlatformId;
/**
* 1 2
*/
@NotNull(message = "企业状态不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer companyStatus;
/**
* ,0,1
*/
@NotNull(message = "企业状态不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isMajorHazard;
/**
* ,0,1
*/
@NotNull(message = "是否重点工艺企业不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isKeyProcess;
/**
* ,0,1
*/
@NotNull(message = "是否重点专项检查企业不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isSpecialInspection;
/**
* ,0,1
*/
@NotNull(message = "是否粉尘涉爆企业不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isDustExplosion;
/**
* ,0,1
*/
@NotNull(message = "是否开启重大危险源数据推送不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isOpenMajorHazard;
/**
* ,0,1
*/
@NotNull(message = "是否开启重点工艺企业数据推送不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isOpenKeyProcess;
/**
* ,0,1
*/
@NotNull(message = "是否开启重点专项检查企业数据推送不能为空", groups = {AddGroup.class, UpdateGroup.class})
private Integer isOpenSpecialInspection;
/**
*
*/
private String companyAddress;
/**
*
*/
private String latitude;
/**
*
*/
private String longitude;
/**
*
*/
private String CompanyContacts;
/**
*
*/
private String companyMobile;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
*
*/
private String county;
/**
*
*/
@NotNull(message = "对接上级平台信息不能为空", groups = {AddGroup.class, UpdateGroup.class})
@Size(min = 1, message = "对接上级平台信息不能为空", groups = {AddGroup.class, UpdateGroup.class})
private List<ThirdPlatformInfoDto> thirdList;
}

View File

@ -0,0 +1,36 @@
package com.zcloud.modules.corp.dto.req;
import lombok.Data;
/**
*
*
* @author dengchengming
* @since 2025-07-14 10:04:43
*/
@Data
public class CompanyQueryDto extends PageDto {
/**
*
*/
private String companyName;
/**
*
*/
private String serviceName;
/**
*
*/
private String platformName;
/**
* : 1:, 2:
*/
private Integer companyStatus;
}

View File

@ -16,4 +16,12 @@ public class PageDto {
*/
private Integer limit;
/**
* offset SQL LIMIT
* offset = (curPage - 1) * limit
*/
public int getOffset() {
return (curPage != null && limit != null && curPage > 0) ? (curPage - 1) * limit : 0;
}
}

View File

@ -0,0 +1,32 @@
package com.zcloud.modules.corp.dto.req;
import lombok.Data;
/**
*
*
* @author dengchengming
* @since 2025-07-14 08:33:07
*/
@Data
public class ServicePlatformQueryDto extends PageDto {
/**
*
*/
private String serviceName;
/**
*
*/
private String serviceCompany;
/**
* : 1:, 2:
*/
private Integer platformStatus;
}

View File

@ -0,0 +1,72 @@
package com.zcloud.modules.corp.dto.req;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* req
*
* @author dengchengming
* @since 2025-07-10 14:37:24
*/
@Data
public class ServicePlatformReqDto {
@NotNull(message = "id不能为空", groups = {UpdateGroup.class, DeleteGroup.class})
private Integer id;
/**
*
*/
@NotBlank(message = "服务平台名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String serviceName;
/**
*
*/
@NotBlank(message = "服务平台单位名称不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String serviceCompany;
/**
*
*/
@NotBlank(message = "服务编码不能为空", groups = {AddGroup.class, UpdateGroup.class})
private String serviceCode;
/**
*
*/
@NotNull(message = "上级平台不能为空", groups = {AddGroup.class, UpdateGroup.class})
@Size(min = 1, message = "上级平台不能为空", groups = {AddGroup.class, UpdateGroup.class})
private List<Integer> thirdIdList;
/**
*
*/
private String serviceUrl;
/**
* : 1:, 2:
*/
private Integer platformStatus;
/**
*
*/
private String platformContacts;
/**
*
*/
private String platformMobile;
}

View File

@ -0,0 +1,87 @@
package com.zcloud.modules.corp.dto.req;
import lombok.Data;
/**
* dto
*
* @author dengchengming
* @since 2025-07-14 15:16:22
*/
@Data
public class ThirdPlatformInfoDto {
private Integer id;
/**
*
*/
private String companyName;
/**
* id
*/
private Integer companyId;
/**
* id
*/
private Integer thirdPlatformId;
/**
*
*/
private String thirdPlatformCode;
/**
* id
*/
private Integer serviceId;
/**
*
*/
private String companyCode;
/**
*
*/
private String majorHazardCode;
/**
* url
*/
private String url;
/**
* 访
*/
private String accessKey;
/**
*
*/
private String rsaPublicKey;
/**
* iv
*/
private String iv;
/**
* code
*/
private String code;
/**
* appid
*/
private String appid;
/**
* secret
*/
private String secret;
}

View File

@ -0,0 +1,132 @@
package com.zcloud.modules.corp.dto.res;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import com.zcloud.modules.corp.dto.req.ThirdPlatformInfoDto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* res
*
* @author dengchengming
* @since 2025-07-14 08:58:43
*/
@Data
public class CompanyInfoResDto {
private Integer id;
/**
*
*/
private String companyName;
/**
*
*/
private String companyCode;
/**
*
*/
private String sector;
/**
* id
*/
private Integer servicePlatformId;
/**
* 1 2
*/
private Integer companyStatus;
/**
* ,0,1
*/
private Integer isMajorHazard;
/**
* ,0,1
*/
private Integer isKeyProcess;
/**
* ,0,1
*/
private Integer isSpecialInspection;
/**
* ,0,1
*/
private Integer isDustExplosion;
/**
* ,0,1
*/
private Integer isOpenMajorHazard;
/**
* ,0,1
*/
private Integer isOpenKeyProcess;
/**
* ,0,1
*/
private Integer isOpenSpecialInspection;
/**
*
*/
private String companyAddress;
/**
*
*/
private String latitude;
/**
*
*/
private String longitude;
/**
*
*/
private String CompanyContacts;
/**
*
*/
private String companyMobile;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
*
*/
private String county;
/**
*
*/
private List<ThirdPlatformInfoDto> thirdList;
}

View File

@ -0,0 +1,153 @@
package com.zcloud.modules.corp.dto.res;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* res
*
* @author dengchengming
* @since 2025-07-14 10:45:51
*/
@Data
public class CompanyResDto {
private Integer id;
/**
*
*/
private String companyName;
/**
*
*/
private String companyCode;
/**
*
*/
private String sector;
/**
*
*/
private String companyAddress;
/**
*
*/
private String latitude;
/**
*
*/
private String longitude;
/**
* : 1:, 2:
*/
private Integer companyStatus;
/**
*
*/
private String companyContacts;
/**
*
*/
private String companyMobile;
/**
* id
*/
private Integer servicePlatformId;
/**
*
*/
private String serviceName;
/**
* ,0,1
*/
private Integer isMajorHazard;
/**
* ,0,1
*/
private Integer isKeyProcess;
/**
* ,0,1
*/
private Integer isSpecialInspection;
/**
* ,0,1
*/
private Integer isDustExplosion;
/**
* ,0,1
*/
private Integer isOpenMajorHazard;
/**
* ,0,1
*/
private Integer isOpenKeyProcess;
/**
* ,0,1
*/
private Integer isOpenSpecialInspection;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
*
*/
private String county;
/**
*
*/
private String createBy;
/**
*
*/
private Date createTime;
/**
*
*/
private String updateBy;
/**
*
*/
private Date updateTime;
/**
* 0:,1:
*/
private Integer isDelete;
private List<ThirdPlatformResDto> thirdList;
}

View File

@ -0,0 +1,61 @@
package com.zcloud.modules.corp.dto.res;
import lombok.Data;
import java.util.List;
/**
* res
*
* @author dengchengming
* @since 2025-07-14 08:58:43
*/
@Data
public class ServicePlatformResDto {
private Integer id;
/**
*
*/
private String serviceName;
/**
*
*/
private String serviceCompany;
/**
*
*/
private String serviceCode;
/**
*
*/
private List<ThirdPlatformResDto> thirdList;
/**
*
*/
private String serviceUrl;
/**
* : 1:, 2:
*/
private Integer platformStatus;
/**
*
*/
private String platformContacts;
/**
*
*/
private String platformMobile;
}

View File

@ -1,17 +1,12 @@
package com.zcloud.modules.corp.dto.res;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import com.zcloud.modules.corp.enums.PlatformLevelEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* req
* res
*
* @author dengchengming
* @since 2025-07-10 14:37:24
@ -53,6 +48,11 @@ public class ThirdPlatformResDto {
*/
private Integer frequency;
/**
*
*/
private Integer fieldCount;
/**
*
*/
@ -68,5 +68,4 @@ public class ThirdPlatformResDto {
*/
private String county;
}
}

View File

@ -36,9 +36,12 @@ public class BusCompanyInfoEntity extends Model<BusCompanyInfoEntity> {
@ApiModelProperty(value = "经营地址")
private String companyAddress;
@ApiModelProperty(value = "地理地址")
private String companyGeoAddress;
@ApiModelProperty(value = "纬度")
private String latitude;
@ApiModelProperty(value = "经度")
private String longitude;
@ApiModelProperty(value = "企业状态,1:正常,2:异常")
private Integer companyStatus;

View File

@ -0,0 +1,19 @@
package com.zcloud.modules.corp.mapper;
import com.zcloud.modules.corp.dto.req.CompanyInfoReqDto;
import com.zcloud.modules.corp.dto.res.CompanyInfoResDto;
import com.zcloud.modules.corp.dto.res.ServicePlatformResDto;
import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface CompanyInfoMapper {
CompanyInfoMapper INSTANCE = Mappers.getMapper(CompanyInfoMapper.class);
BusCompanyInfoEntity toEntity(CompanyInfoReqDto req);
CompanyInfoResDto toRes(BusCompanyInfoEntity entity);
}

View File

@ -0,0 +1,18 @@
package com.zcloud.modules.corp.mapper;
import com.zcloud.modules.corp.dto.req.ThirdPlatformInfoDto;
import com.zcloud.modules.corp.dto.res.ThirdPlatformResDto;
import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface CompanyThirdRelationMapper {
CompanyThirdRelationMapper INSTANCE = Mappers.getMapper(CompanyThirdRelationMapper.class);
List<ThirdPlatformInfoDto> toResList(List<BusCompanyThirdRelationEntity> entityList);
}

View File

@ -0,0 +1,17 @@
package com.zcloud.modules.corp.mapper;
import com.zcloud.modules.corp.dto.req.ServicePlatformReqDto;
import com.zcloud.modules.corp.dto.res.ServicePlatformResDto;
import com.zcloud.modules.corp.entity.BusServicePlatformEntity;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@Mapper
public interface ServicePlatformMapper {
ServicePlatformMapper INSTANCE = Mappers.getMapper(ServicePlatformMapper.class);
BusServicePlatformEntity toEntity(ServicePlatformReqDto obj);
ServicePlatformResDto toRes(BusServicePlatformEntity entity);
}

View File

@ -7,6 +7,8 @@ import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.factory.Mappers;
import java.util.List;
@Mapper
public interface ThirdPlatformMapper {
@ -16,4 +18,5 @@ public interface ThirdPlatformMapper {
BusThirdPlatformEntity toEntity(ThirdPlatformReqDto obj);
ThirdPlatformResDto toRes(BusThirdPlatformEntity entity);
List<ThirdPlatformResDto> toResList(List<BusThirdPlatformEntity> entity);
}

View File

@ -1,6 +1,10 @@
package com.zcloud.modules.corp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.modules.corp.dto.req.CompanyInfoReqDto;
import com.zcloud.modules.corp.dto.req.CompanyQueryDto;
import com.zcloud.modules.corp.dto.res.CompanyInfoResDto;
import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
/**
@ -11,5 +15,14 @@ import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
*/
public interface BusCompanyInfoService extends IService<BusCompanyInfoEntity> {
PageUtils queryPage(CompanyQueryDto req);
void save(CompanyInfoReqDto req);
CompanyInfoResDto detail(CompanyInfoReqDto req);
void updateById(CompanyInfoReqDto req);
void deleteById(CompanyInfoReqDto req);
}

View File

@ -1,8 +1,17 @@
package com.zcloud.modules.corp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zcloud.common.validator.group.AddGroup;
import com.zcloud.common.validator.group.DeleteGroup;
import com.zcloud.common.validator.group.UpdateGroup;
import com.zcloud.modules.corp.dto.req.ThirdPlatformInfoDto;
import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
* (BusCompanyThirdRelation)
*
@ -11,5 +20,12 @@ import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
*/
public interface BusCompanyThirdRelationService extends IService<BusCompanyThirdRelationEntity> {
void insertList(BusCompanyInfoEntity info, Integer serviceId, List<ThirdPlatformInfoDto> thirdList);
void updateBatch(BusCompanyInfoEntity entity, Integer servicePlatformId, List<ThirdPlatformInfoDto> thirdList);
void delByCompanyId(Integer companyId);
List<BusCompanyThirdRelationEntity> getByCommpanyId(Integer companyId);
}

View File

@ -1,8 +1,14 @@
package com.zcloud.modules.corp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.modules.corp.dto.req.ServicePlatformQueryDto;
import com.zcloud.modules.corp.dto.req.ServicePlatformReqDto;
import com.zcloud.modules.corp.dto.res.ServicePlatformResDto;
import com.zcloud.modules.corp.entity.BusServicePlatformEntity;
import java.util.List;
/**
* (BusServicePlatform)
*
@ -11,5 +17,16 @@ import com.zcloud.modules.corp.entity.BusServicePlatformEntity;
*/
public interface BusServicePlatformService extends IService<BusServicePlatformEntity> {
PageUtils queryPage(ServicePlatformQueryDto req);
void save(ServicePlatformReqDto req);
ServicePlatformResDto detail(ServicePlatformReqDto req);
void updateById(ServicePlatformReqDto req);
void deleteById(ServicePlatformReqDto req);
List<ServicePlatformResDto> listAll();
}

View File

@ -3,6 +3,8 @@ package com.zcloud.modules.corp.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zcloud.modules.corp.entity.BusServiceThirdRelationEntity;
import java.util.List;
/**
* (BusServiceThirdRelation)
*
@ -11,5 +13,12 @@ import com.zcloud.modules.corp.entity.BusServiceThirdRelationEntity;
*/
public interface BusServiceThirdRelationService extends IService<BusServiceThirdRelationEntity> {
void saveBatch(Integer serviceId, List<Integer> thirdIdList);
List<BusServiceThirdRelationEntity> getByServiceId(Integer serviceId);
void updateBatch(Integer serviceId, List<Integer> thirdIdList);
void delByServiceId(Integer serviceId);
}

View File

@ -7,6 +7,8 @@ import com.zcloud.modules.corp.dto.req.ThirdPlatformReqDto;
import com.zcloud.modules.corp.dto.res.ThirdPlatformResDto;
import com.zcloud.modules.corp.entity.BusThirdPlatformEntity;
import java.util.List;
/**
* (BusThirdPlatform)
*
@ -25,5 +27,9 @@ public interface BusThirdPlatformService extends IService<BusThirdPlatformEntity
ThirdPlatformResDto detail(ThirdPlatformReqDto req);
List<ThirdPlatformResDto> listAll();
List<BusThirdPlatformEntity> getByServiceId(Integer serviceId);
}

View File

@ -1,10 +1,26 @@
package com.zcloud.modules.corp.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.ShiroUtils;
import com.zcloud.modules.corp.dao.BusCompanyInfoDao;
import com.zcloud.modules.corp.dto.req.CompanyInfoReqDto;
import com.zcloud.modules.corp.dto.req.CompanyQueryDto;
import com.zcloud.modules.corp.dto.req.ThirdPlatformInfoDto;
import com.zcloud.modules.corp.dto.res.CompanyInfoResDto;
import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
import com.zcloud.modules.corp.enums.YesOrNoEnum;
import com.zcloud.modules.corp.mapper.CompanyInfoMapper;
import com.zcloud.modules.corp.mapper.CompanyThirdRelationMapper;
import com.zcloud.modules.corp.service.BusCompanyInfoService;
import com.zcloud.modules.corp.service.BusCompanyThirdRelationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
* (BusCompanyInfo)
@ -15,5 +31,65 @@ import org.springframework.stereotype.Service;
@Service("busCompanyInfoService")
public class BusCompanyInfoServiceImpl extends ServiceImpl<BusCompanyInfoDao, BusCompanyInfoEntity> implements BusCompanyInfoService {
@Autowired
private BusCompanyThirdRelationService companyThirdRelationService;
@Override
public PageUtils queryPage(CompanyQueryDto req) {
int total = baseMapper.selectCount(req);
List<BusCompanyInfoEntity> result = baseMapper.selectPage(req, req.getOffset(), req.getLimit());
return new PageUtils(result, total, req.getLimit(), req.getCurPage());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(CompanyInfoReqDto req) {
BusCompanyInfoEntity entity = CompanyInfoMapper.INSTANCE.toEntity(req);
entity.setCreateBy(ShiroUtils.getUsername());
entity.setCreateTime(new Date());
entity.setIsDelete(YesOrNoEnum.NO.getCode());
baseMapper.insert(entity);
companyThirdRelationService.insertList(entity, req.getServicePlatformId(), req.getThirdList());
}
@Override
public CompanyInfoResDto detail(CompanyInfoReqDto req) {
BusCompanyInfoEntity entity = getById(req.getId());
if (entity == null || YesOrNoEnum.YES.getCode().equals(entity.getIsDelete())) {
return null;
}
CompanyInfoResDto resDto = CompanyInfoMapper.INSTANCE.toRes(entity);
List<BusCompanyThirdRelationEntity> entityList = companyThirdRelationService.getByCommpanyId(req.getId());
List<ThirdPlatformInfoDto> list = CompanyThirdRelationMapper.INSTANCE.toResList(entityList);
resDto.setThirdList(list);
return resDto;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateById(CompanyInfoReqDto req) {
BusCompanyInfoEntity entity = CompanyInfoMapper.INSTANCE.toEntity(req);
entity.setUpdateBy(ShiroUtils.getUsername());
entity.setUpdateTime(new Date());
baseMapper.updateById(entity);
companyThirdRelationService.updateBatch(entity, req.getServicePlatformId(), req.getThirdList());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteById(CompanyInfoReqDto req) {
BusCompanyInfoEntity del = new BusCompanyInfoEntity();
del.setId(req.getId());
del.setUpdateBy(ShiroUtils.getUsername());
del.setUpdateTime(new Date());
del.setIsDelete(YesOrNoEnum.YES.getCode());
baseMapper.updateById(del);
companyThirdRelationService.delByCompanyId(req.getId());
}
}

View File

@ -1,11 +1,22 @@
package com.zcloud.modules.corp.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcloud.common.utils.ShiroUtils;
import com.zcloud.modules.corp.dao.BusCompanyThirdRelationDao;
import com.zcloud.modules.corp.dto.req.ThirdPlatformInfoDto;
import com.zcloud.modules.corp.entity.BusCompanyInfoEntity;
import com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity;
import com.zcloud.modules.corp.enums.YesOrNoEnum;
import com.zcloud.modules.corp.service.BusCompanyThirdRelationService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* (BusCompanyThirdRelation)
*
@ -15,5 +26,76 @@ import org.springframework.stereotype.Service;
@Service("busCompanyThirdRelationService")
public class BusCompanyThirdRelationServiceImpl extends ServiceImpl<BusCompanyThirdRelationDao, BusCompanyThirdRelationEntity> implements BusCompanyThirdRelationService {
@Override
public void insertList(BusCompanyInfoEntity info, Integer serviceId, List<ThirdPlatformInfoDto> thirdList) {
List<BusCompanyThirdRelationEntity> insertList = buildList(info, serviceId, thirdList);
baseMapper.insertList(insertList);
}
private static List<BusCompanyThirdRelationEntity> buildList(BusCompanyInfoEntity info, Integer serviceId, List<ThirdPlatformInfoDto> thirdList) {
List<BusCompanyThirdRelationEntity> insertList = new ArrayList<>();
String username = ShiroUtils.getUsername();
Date now = new Date();
for (ThirdPlatformInfoDto dto : thirdList) {
BusCompanyThirdRelationEntity entity = new BusCompanyThirdRelationEntity();
entity.setCompanyId(info.getId());
entity.setCompanyName(info.getCompanyName());
entity.setCompanyCode(info.getCompanyCode());
entity.setThirdPlatformId(dto.getThirdPlatformId());
entity.setThirdPlatformCode(dto.getThirdPlatformCode());
entity.setServiceId(serviceId);
entity.setMajorHazardCode(dto.getMajorHazardCode());
entity.setAccessKey(dto.getAccessKey());
entity.setRsaPublicKey(dto.getRsaPublicKey());
entity.setIv(dto.getIv());
entity.setUrl(dto.getUrl());
entity.setCode(dto.getCode());
entity.setAppid(dto.getAppid());
entity.setSecret(dto.getSecret());
entity.setCreateBy(username);
entity.setCreateTime(now);
entity.setUpdateBy(username);
entity.setUpdateTime(now);
entity.setIsDelete(YesOrNoEnum.NO.getCode());
insertList.add(entity);
}
return insertList;
}
@Override
public void updateBatch(BusCompanyInfoEntity info, Integer serviceId, List<ThirdPlatformInfoDto> thirdList) {
BusCompanyThirdRelationEntity del = new BusCompanyThirdRelationEntity();
del.setUpdateBy(ShiroUtils.getUsername());
del.setUpdateTime(new Date());
del.setCompanyId(info.getId());
baseMapper.delByCondition(del);
if (CollectionUtil.isEmpty(thirdList)) {
return;
}
List<BusCompanyThirdRelationEntity> list = buildList(info, serviceId, thirdList);
baseMapper.insertList(list);
}
@Override
public void delByCompanyId(Integer companyId) {
BusCompanyThirdRelationEntity del = new BusCompanyThirdRelationEntity();
del.setUpdateBy(ShiroUtils.getUsername());
del.setUpdateTime(new Date());
del.setCompanyId(companyId);
baseMapper.delByCondition(del);
}
@Override
public List<BusCompanyThirdRelationEntity> getByCommpanyId(Integer companyId) {
LambdaQueryWrapper<BusCompanyThirdRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BusCompanyThirdRelationEntity::getIsDelete, YesOrNoEnum.NO.getCode());
wrapper.eq(BusCompanyThirdRelationEntity::getCompanyId, companyId);
return baseMapper.selectList(wrapper);
}
}

View File

@ -1,10 +1,31 @@
package com.zcloud.modules.corp.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.ShiroUtils;
import com.zcloud.modules.corp.dao.BusServicePlatformDao;
import com.zcloud.modules.corp.dto.req.ServicePlatformQueryDto;
import com.zcloud.modules.corp.dto.req.ServicePlatformReqDto;
import com.zcloud.modules.corp.dto.res.ServicePlatformResDto;
import com.zcloud.modules.corp.dto.res.ThirdPlatformResDto;
import com.zcloud.modules.corp.entity.BusServicePlatformEntity;
import com.zcloud.modules.corp.entity.BusThirdPlatformEntity;
import com.zcloud.modules.corp.enums.YesOrNoEnum;
import com.zcloud.modules.corp.mapper.ServicePlatformMapper;
import com.zcloud.modules.corp.mapper.ThirdPlatformMapper;
import com.zcloud.modules.corp.service.BusServicePlatformService;
import com.zcloud.modules.corp.service.BusServiceThirdRelationService;
import com.zcloud.modules.corp.service.BusThirdPlatformService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* (BusServicePlatform)
@ -15,5 +36,86 @@ import org.springframework.stereotype.Service;
@Service("busServicePlatformService")
public class BusServicePlatformServiceImpl extends ServiceImpl<BusServicePlatformDao, BusServicePlatformEntity> implements BusServicePlatformService {
@Autowired
private BusServiceThirdRelationService serviceThirdRelationService;
@Autowired
private BusThirdPlatformService thirdPlatformService;
@Override
public PageUtils queryPage(ServicePlatformQueryDto req) {
Page<BusServicePlatformEntity> page = new Page<>(req.getCurPage(), req.getLimit());
IPage<BusServicePlatformEntity> iPage = baseMapper.selectPage(page, req);
IPage<ServicePlatformResDto> result = new Page<>(iPage.getCurrent(),
iPage.getSize(),
iPage.getTotal());
List<ServicePlatformResDto> dtoList = new ArrayList<>();
for (BusServicePlatformEntity record : iPage.getRecords()) {
ServicePlatformResDto res = ServicePlatformMapper.INSTANCE.toRes(record);
List<BusThirdPlatformEntity> list = thirdPlatformService.getByServiceId(res.getId());
List<ThirdPlatformResDto> resList = ThirdPlatformMapper.INSTANCE.toResList(list);
res.setThirdList(resList);
dtoList.add(res);
}
result.setRecords(dtoList);
return new PageUtils(result);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ServicePlatformReqDto req) {
BusServicePlatformEntity entity = ServicePlatformMapper.INSTANCE.toEntity(req);
entity.setCreateBy(ShiroUtils.getUsername());
entity.setCreateTime(new Date());
entity.setIsDelete(YesOrNoEnum.NO.getCode());
baseMapper.insert(entity);
serviceThirdRelationService.saveBatch(entity.getId(), req.getThirdIdList());
}
@Override
public ServicePlatformResDto detail(ServicePlatformReqDto req) {
BusServicePlatformEntity entity = getById(req.getId());
if (entity == null || YesOrNoEnum.YES.getCode().equals(entity.getIsDelete())) {
return null;
}
return ServicePlatformMapper.INSTANCE.toRes(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateById(ServicePlatformReqDto req) {
BusServicePlatformEntity entity = ServicePlatformMapper.INSTANCE.toEntity(req);
entity.setUpdateBy(ShiroUtils.getUsername());
entity.setUpdateTime(new Date());
baseMapper.updateById(entity);
serviceThirdRelationService.updateBatch(entity.getId(), req.getThirdIdList());
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteById(ServicePlatformReqDto req) {
BusServicePlatformEntity entity = new BusServicePlatformEntity();
entity.setId(req.getId());
entity.setUpdateBy(ShiroUtils.getUsername());
entity.setUpdateTime(new Date());
entity.setIsDelete(YesOrNoEnum.YES.getCode());
baseMapper.updateById(entity);
serviceThirdRelationService.delByServiceId(entity.getId());
}
@Override
public List<ServicePlatformResDto> listAll() {
// List<ServicePlatformResDto> res = baseMapper.getAll();
return Collections.emptyList();
}
}

View File

@ -1,11 +1,19 @@
package com.zcloud.modules.corp.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcloud.common.utils.ShiroUtils;
import com.zcloud.modules.corp.dao.BusServiceThirdRelationDao;
import com.zcloud.modules.corp.entity.BusServiceThirdRelationEntity;
import com.zcloud.modules.corp.enums.YesOrNoEnum;
import com.zcloud.modules.corp.service.BusServiceThirdRelationService;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* (BusServiceThirdRelation)
*
@ -15,5 +23,65 @@ import org.springframework.stereotype.Service;
@Service("busServiceThirdRelationService")
public class BusServiceThirdRelationServiceImpl extends ServiceImpl<BusServiceThirdRelationDao, BusServiceThirdRelationEntity> implements BusServiceThirdRelationService {
@Override
public void saveBatch(Integer serviceId, List<Integer> thirdIdList) {
if (CollectionUtil.isEmpty(thirdIdList)) {
return;
}
List<BusServiceThirdRelationEntity> list = buildList(serviceId, thirdIdList);
baseMapper.insertList(list);
}
private static List<BusServiceThirdRelationEntity> buildList(Integer serviceId, List<Integer> thirdIdList) {
List<BusServiceThirdRelationEntity> list = new ArrayList<>();
Date now = new Date();
for (Integer thirdId : thirdIdList) {
BusServiceThirdRelationEntity entity = new BusServiceThirdRelationEntity();
entity.setServiceId(serviceId);
entity.setThirdPlatformId(thirdId);
entity.setCreateBy(ShiroUtils.getUsername());
entity.setCreateTime(now);
entity.setUpdateBy(ShiroUtils.getUsername());
entity.setUpdateTime(now);
entity.setIsDelete(YesOrNoEnum.NO.getCode());
list.add(entity);
}
return list;
}
@Override
public List<BusServiceThirdRelationEntity> getByServiceId(Integer serviceId) {
LambdaQueryWrapper<BusServiceThirdRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BusServiceThirdRelationEntity::getIsDelete, YesOrNoEnum.NO.getCode());
wrapper.eq(BusServiceThirdRelationEntity::getServiceId, serviceId);
return baseMapper.selectList(wrapper);
}
@Override
public void updateBatch(Integer serviceId, List<Integer> thirdIdList) {
BusServiceThirdRelationEntity del = new BusServiceThirdRelationEntity();
del.setUpdateBy(ShiroUtils.getUsername());
del.setUpdateTime(new Date());
del.setServiceId(serviceId);
baseMapper.delByCondition(del);
if (CollectionUtil.isEmpty(thirdIdList)) {
return;
}
List<BusServiceThirdRelationEntity> list = buildList(serviceId, thirdIdList);
baseMapper.insertList(list);
}
@Override
public void delByServiceId(Integer serviceId) {
BusServiceThirdRelationEntity del = new BusServiceThirdRelationEntity();
del.setUpdateBy(ShiroUtils.getUsername());
del.setUpdateTime(new Date());
del.setServiceId(serviceId);
baseMapper.delByCondition(del);
}
}

View File

@ -59,10 +59,9 @@ public class BusThirdDataItemsRelationServiceImpl extends ServiceImpl<BusThirdDa
BusThirdDataItemsRelationEntity del = new BusThirdDataItemsRelationEntity();
del.setUpdateBy(ShiroUtils.getUsername());
del.setUpdateTime(new Date());
del.setIsDelete(YesOrNoEnum.YES.getCode());
del.setMenuId(req.getMenuId());
del.setThirdPlatformId(req.getThirdPlatformId());
baseMapper.updateByCondition(del);
baseMapper.delByCondition(del);
List<DataItemsResDto> list = req.getList();
Date now = new Date();
@ -87,5 +86,12 @@ public class BusThirdDataItemsRelationServiceImpl extends ServiceImpl<BusThirdDa
baseMapper.insertList(entityList);
}
public int getCountByThirdId(Integer thirdPlatformId) {
LambdaQueryWrapper<BusThirdDataItemsRelationEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BusThirdDataItemsRelationEntity::getThirdPlatformId, thirdPlatformId);
wrapper.eq(BusThirdDataItemsRelationEntity::getIsDelete, DataIsDeleteEnum.NO.getCode());
return baseMapper.selectCount(wrapper);
}
}

View File

@ -1,6 +1,7 @@
package com.zcloud.modules.corp.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcloud.common.utils.PageUtils;
@ -17,7 +18,9 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* (BusThirdPlatform)
@ -29,6 +32,12 @@ import java.util.Date;
public class BusThirdPlatformServiceImpl extends ServiceImpl<BusThirdPlatformDao, BusThirdPlatformEntity> implements BusThirdPlatformService {
private final BusThirdDataItemsRelationServiceImpl busThirdDataItemsRelationService;
public BusThirdPlatformServiceImpl(BusThirdDataItemsRelationServiceImpl busThirdDataItemsRelationService) {
this.busThirdDataItemsRelationService = busThirdDataItemsRelationService;
}
@Override
public PageUtils queryPage(ThirdPlatformQueryDto req) {
Page<BusThirdPlatformEntity> page = new Page<>(req.getCurPage(), req.getLimit());
@ -45,8 +54,21 @@ public class BusThirdPlatformServiceImpl extends ServiceImpl<BusThirdPlatformDao
if (req.getPlatformStatus() != null) {
wrapper.eq(BusThirdPlatformEntity::getPlatformStatus, req.getPlatformStatus());
}
IPage<BusThirdPlatformEntity> iPage = page(page, wrapper);
IPage<ThirdPlatformResDto> result = new Page<>(iPage.getCurrent(),
iPage.getSize(),
iPage.getTotal());
return new PageUtils(page(page, wrapper));
List<ThirdPlatformResDto> list = new ArrayList<>();
for (BusThirdPlatformEntity record : iPage.getRecords()) {
ThirdPlatformResDto dto = ThirdPlatformMapper.INSTANCE.toRes(record);
int count = busThirdDataItemsRelationService.getCountByThirdId(record.getId());
dto.setFieldCount(count);
list.add(dto);
}
result.setRecords(list);
return new PageUtils(result);
}
@Override
@ -82,10 +104,27 @@ public class BusThirdPlatformServiceImpl extends ServiceImpl<BusThirdPlatformDao
@Override
public ThirdPlatformResDto detail(ThirdPlatformReqDto req) {
BusThirdPlatformEntity entity = getById(req.getId());
if (YesOrNoEnum.YES.getCode().equals(entity.getIsDelete())) {
if (entity == null || YesOrNoEnum.YES.getCode().equals(entity.getIsDelete())) {
return null;
}
return ThirdPlatformMapper.INSTANCE.toRes(entity);
}
@Override
public List<ThirdPlatformResDto> listAll() {
List<BusThirdPlatformEntity> list = getAll();
return ThirdPlatformMapper.INSTANCE.toResList(list);
}
private List<BusThirdPlatformEntity> getAll() {
LambdaQueryWrapper<BusThirdPlatformEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(BusThirdPlatformEntity::getIsDelete, YesOrNoEnum.NO.getCode());
return baseMapper.selectList(wrapper);
}
@Override
public List<BusThirdPlatformEntity> getByServiceId(Integer serviceId) {
return baseMapper.getByServiceId(serviceId);
}
}

View File

@ -103,6 +103,16 @@ public class SysDictionariesController extends AbstractController {
return R.ok().put("dictionariesList", dictionariesList);
}
/**
*
*/
@PostMapping("/area")
@ApiOperation(value = "获取省市区")
public R listTreeByLevel() {
List<SysDictionariesEntity> dictionariesList = sysDictionariesService.getArea();
return R.ok().put("dictionariesList", dictionariesList);
}
/**
*
*/

View File

@ -75,4 +75,6 @@ public interface SysDictionariesService extends IService<SysDictionariesEntity>
// }
void importAreaFromJson();
List<SysDictionariesEntity> getArea();
}

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zcloud.common.utils.Const;
import com.zcloud.common.utils.PageUtils;
import com.zcloud.common.utils.Query;
import com.zcloud.modules.sys.dao.SysDictionariesDao;
@ -16,10 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
@Service("sysDictionariesService")
@ -91,7 +89,7 @@ public class SysDictionariesServiceImpl extends ServiceImpl<SysDictionariesDao,
*
*/
private List<SysDictionariesEntity> getdictionariesTreeList(List<SysDictionariesEntity> dictionariesList){
List<SysDictionariesEntity> subdictionariesList = new ArrayList<SysDictionariesEntity>();
List<SysDictionariesEntity> subdictionariesList = new ArrayList<>();
for(SysDictionariesEntity entity : dictionariesList){
entity.setList(getdictionariesTreeList(queryListParentId(entity.getDictionaryId())));
@ -177,6 +175,42 @@ public class SysDictionariesServiceImpl extends ServiceImpl<SysDictionariesDao,
}
}
@Override
public List<SysDictionariesEntity> getArea() {
return getAlldictionariesList(Const.AREA_PARENT_ID, 3);
}
/**
*
*/
private List<SysDictionariesEntity> getAlldictionariesList(String parentId, Integer maxLevel) {
//查询根菜单列表
List<SysDictionariesEntity> dictionariesList = queryListParentId(parentId);
//递归获取子菜单
getdictionariesTreeList(dictionariesList, maxLevel, 0);
return dictionariesList;
}
/**
*
*/
private List<SysDictionariesEntity> getdictionariesTreeList(List<SysDictionariesEntity> dictionariesList, Integer maxLevel, Integer currentLevel) {
List<SysDictionariesEntity> subdictionariesList = new ArrayList<>();
if (currentLevel >= maxLevel) {
return subdictionariesList;
}
for(SysDictionariesEntity entity : dictionariesList) {
entity.setList(getdictionariesTreeList(queryListParentId(entity.getDictionaryId()), maxLevel, ++currentLevel));
subdictionariesList.add(entity);
}
return subdictionariesList;
}
public static String get32UUID() {
String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
return uuid;

View File

@ -0,0 +1,100 @@
<?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.zcloud.modules.corp.dao.BusCompanyInfoDao">
<resultMap id="resultMap" type="com.zcloud.modules.corp.dto.res.CompanyResDto">
<id property="id" column="id"/>
<result property="companyName" column="company_name"/>
<result property="companyCode" column="company_code"/>
<result property="sector" column="sector"/>
<result property="companyAddress" column="company_address"/>
<result property="latitude" column="latitude"/>
<result property="longitude" column="longitude"/>
<result property="companyStatus" column="company_status"/>
<result property="companyContacts" column="company_contacts"/>
<result property="companyMobile" column="company_mobile"/>
<result property="servicePlatformId" column="service_platform_id"/>
<result property="isMajorHazard" column="is_major_hazard"/>
<result property="isKeyProcess" column="is_key_process"/>
<result property="isSpecialInspection" column="is_special_inspection"/>
<result property="isDustExplosion" column="is_dust_explosion"/>
<result property="isOpenMajorHazard" column="is_open_major_hazard"/>
<result property="isOpenKeyProcess" column="is_open_key_process"/>
<result property="isOpenSpecialInspection" column="is_open_special_inspection"/>
<result property="province" column="province"/>
<result property="city" column="city"/>
<result property="county" column="county"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="isDelete" column="is_delete"/>
<result property="servicePlatformId" column="service_platform_id"/>
<result property="serviceName" column="service_name"/>
<collection property="thirdList" ofType="com.zcloud.modules.corp.dto.res.ThirdPlatformResDto">
<id property="id" column="platform_id"/>
<result property="platformName" column="platform_name"/>
</collection>
</resultMap>
<select id="selectCount" resultType="int" parameterType="com.zcloud.modules.corp.dto.req.CompanyQueryDto">
select
count(distinct c.id)
from (select * from
bus_company_info
where
is_delete = 0
<if test="req.companyName != null and req.companyName != ''">
and company_name like concat('%',#{req.companyName},'%')
</if>
<if test="req.companyStatus != null">
and company_status = #{req.companyStatus}
</if>
) c
left join bus_service_platform s on c.service_platform_id = s.id
left join bus_service_third_relation st on s.id = st.service_id
left join bus_third_platform t on t.id = st.third_platform_id
<include refid="Where_Condition"></include>
order by c.create_time desc
</select>
<select id="selectPage" resultMap="resultMap" parameterType="com.zcloud.modules.corp.dto.req.CompanyQueryDto">
select
c.*,
s.id as service_platform_id,
s.service_name,
t.id as platform_id,
t.platform_name
from (select * from
bus_company_info
where
is_delete = 0
<if test="req.companyName != null and req.companyName != ''">
and company_name like concat('%',#{req.companyName},'%')
</if>
<if test="req.companyStatus != null">
and company_status = #{req.companyStatus}
</if>
limit #{offset}, #{limit}) c
left join bus_service_platform s on c.service_platform_id = s.id
left join bus_service_third_relation st on s.id = st.service_id
left join bus_third_platform t on t.id = st.third_platform_id
<include refid="Where_Condition"></include>
order by c.create_time desc
</select>
<sql id="Where_Condition">
<where>
s.is_delete = 0 and st.is_delete = 0 and t.is_delete = 0
<if test="req.platformName != null and req.platformName != ''">
and t.platform_name like concat('%',#{req.platformName},'%')
</if>
<if test="req.platformName != null and req.platformName != ''">
and t.platform_name like concat('%',#{req.platformName},'%')
</if>
</where>
</sql>
</mapper>

View File

@ -0,0 +1,66 @@
<?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.zcloud.modules.corp.dao.BusCompanyThirdRelationDao">
<insert id="insertList" parameterType="java.util.List">
INSERT INTO
bus_company_third_relation (
company_name,
company_id,
third_platform_id,
third_platform_code,
service_id,
company_code,
major_hazard_code,
url,
access_key,
rsa_public_key,
iv,
code,
appid,
secret,
create_by,
create_time,
update_by,
update_time,
is_delete
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.companyName},
#{item.companyId},
#{item.thirdPlatformId},
#{item.thirdPlatformCode},
#{item.serviceId},
#{item.companyCode},
#{item.majorHazardCode},
#{item.url},
#{item.accessKey},
#{item.rsaPublicKey},
#{item.iv},
#{item.code},
#{item.appid},
#{item.secret},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.isDelete}
)
</foreach>
</insert>
<update id="delByCondition" parameterType="com.zcloud.modules.corp.entity.BusCompanyThirdRelationEntity">
UPDATE
bus_company_third_relation
SET
update_by = #{updateBy},
update_time = #{updateTime},
is_delete = 1
WHERE
company_id = #{companyId}
and is_delete = 0
</update>
</mapper>

View File

@ -0,0 +1,35 @@
<?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.zcloud.modules.corp.dao.BusServicePlatformDao">
<resultMap id="resultMap" type="com.zcloud.modules.corp.dto.res.ServicePlatformResDto">
<id property="id" column="id"/>
<result property="serviceName" column="service_name"/>
<result property="serviceCompany" column="service_company"/>
<result property="serviceCode" column="service_code"/>
<result property="serviceUrl" column="service_code"/>
<result property="platformStatus" column="platform_status"/>
<result property="platformContacts" column="platform_contacts"/>
<result property="platformMobile" column="platform_mobile"/>
</resultMap>
<select id="selectPage" resultType="com.zcloud.modules.corp.entity.BusServicePlatformEntity"
parameterType="com.zcloud.modules.corp.dto.req.ServicePlatformQueryDto">
select
s.*
from bus_service_platform s
<where>
s.is_delete = 0
<if test="req.serviceName != null and req.serviceName != ''">
and s.service_name like concat('%',#{req.serviceName},'%')
</if>
<if test="req.serviceCompany != null and req.serviceCompany != ''">
and s.service_company like concat('%',#{req.serviceCompany},'%')
</if>
<if test="req.platformStatus != null">
and s.platform_status = #{req.platformStatus}
</if>
</where>
</select>
</mapper>

View File

@ -0,0 +1,42 @@
<?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.zcloud.modules.corp.dao.BusServiceThirdRelationDao">
<insert id="insertList" parameterType="java.util.List">
INSERT INTO
bus_service_third_relation (
third_platform_id,
service_id,
create_by,
create_time,
update_by,
update_time,
is_delete
)
VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.thirdPlatformId},
#{item.serviceId},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.isDelete}
)
</foreach>
</insert>
<update id="delByCondition" parameterType="com.zcloud.modules.corp.entity.BusServiceThirdRelationEntity">
UPDATE
bus_service_third_relation
SET
update_by = #{updateBy},
update_time = #{updateTime},
is_delete = 1
WHERE
service_id = #{serviceId}
and is_delete = 0
</update>
</mapper>

View File

@ -35,16 +35,17 @@
</foreach>
</insert>
<update id="updateByCondition" parameterType="com.zcloud.modules.corp.entity.BusThirdDataItemsRelationEntity">
<update id="delByCondition" parameterType="com.zcloud.modules.corp.entity.BusThirdDataItemsRelationEntity">
UPDATE
bus_third_data_items_relation
SET
update_by = #{updateBy},
update_time = #{updateTime},
is_delete = #{isDelete}
is_delete = 1
WHERE
menu_id = #{menuId}
AND third_platform_id = #{thirdPlatformId}
and is_delete = 0
</update>
</mapper>

View File

@ -0,0 +1,13 @@
<?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.zcloud.modules.corp.dao.BusThirdPlatformDao">
<select id="getByServiceId" resultType="com.zcloud.modules.corp.entity.BusThirdPlatformEntity">
select t.*
from bus_third_platform t
join bus_service_third_relation st on t.id = st.third_platform_id
join bus_service_platform s on s.id = st.service_id
where t.is_delete = 0 and st.is_delete = 0 and s.is_delete = 0 and s.id = #{serviceId}
</select>
</mapper>