提交 68d782d7 作者: 张小凤

Commpany(add)

上级 96965dd1
package com.mmc.pms.auth.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Author small
* @Date 2023/7/4 10:55
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoDTO {
private static final long serialVersionUID = 3247519744829926132L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", example = "0")
private Integer companyType;
@ApiModelProperty(value = "单位名称", example = "科比特")
private String companyName;
@ApiModelProperty(value = "单位全称", example = "浙江科比特创新科技有限公司")
private String fullName;
@ApiModelProperty(value = "省份名称", example = "广东省")
private String province;
@ApiModelProperty(value = "城市名称", example = "深圳市")
private String city;
@ApiModelProperty(value = "县区名称", example = "南山区")
private String district;
@ApiModelProperty(value = "详细地址", example = "西丽街道万科云城国际创新谷6栋")
private String address;
@ApiModelProperty(value = "联系人", example = "lx")
private String companyUserName;
@ApiModelProperty(value = "联系电话", example = "13925255742")
private String phoneNum;
@ApiModelProperty(value = "备注")
private String remark;
}
package com.mmc.pms.auth.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/7/4 10:04
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoVO {
private static final long serialVersionUID = 3247519744829926132L;
@ApiModelProperty(value = "id")
private Integer id;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", example = "0")
private Integer companyType;
@ApiModelProperty(value = "单位名称", example = "科比特")
private String companyName;
@ApiModelProperty(value = "单位全称", example = "浙江科比特创新科技有限公司")
private String fullName;
@ApiModelProperty(value = "省份名称", example = "广东省")
private String province;
@ApiModelProperty(value = "城市名称", example = "深圳市")
private String city;
@ApiModelProperty(value = "县区名称", example = "南山区")
private String district;
@ApiModelProperty(value = "详细地址", example = "西丽街道万科云城国际创新谷6栋")
private String address;
@ApiModelProperty(value = "联系人", example = "lx")
private String companyUserName;
@ApiModelProperty(value = "联系电话", example = "13925255742")
private String phoneNum;
@ApiModelProperty(value = "备注")
private String remark;
}
...@@ -26,5 +26,6 @@ public class LoginSuccessDTO implements Serializable { ...@@ -26,5 +26,6 @@ public class LoginSuccessDTO implements Serializable {
private String phoneNum; private String phoneNum;
private String userName; private String userName;
private String nickName; private String nickName;
private CompanyInfoVO companyInfoVO;
// private RoleInfoDTO roleInfo; // private RoleInfoDTO roleInfo;
} }
...@@ -64,8 +64,8 @@ public class BackstageTaskServiceController extends BaseController { ...@@ -64,8 +64,8 @@ public class BackstageTaskServiceController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ServiceDTO.class)})
@GetMapping("queryWorkService") @GetMapping("queryWorkService")
public ResultBody<ServiceDTO> queryWorkService( public ResultBody<ServiceDTO> queryWorkService(
@ApiParam("作业服务id") @RequestParam(value = "id") Integer id) { @ApiParam("作业服务id") @RequestParam(value = "id") Integer id,HttpServletRequest request) {
return backstageTaskService.queryById(id); return backstageTaskService.queryById(id,request);
} }
@ApiOperation(value = "查询服务管理列表") @ApiOperation(value = "查询服务管理列表")
...@@ -75,7 +75,7 @@ public class BackstageTaskServiceController extends BaseController { ...@@ -75,7 +75,7 @@ public class BackstageTaskServiceController extends BaseController {
@Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) { @Validated(Page.class) @RequestBody ServiceQO param, HttpServletRequest request) {
return ResultBody.success( return ResultBody.success(
backstageTaskService.queryServiceManagerList( backstageTaskService.queryServiceManagerList(
param, this.getUserLoginInfoFromRedis(request).getUserAccountId())); param, this.getUserLoginInfoFromRedis(request).getUserAccountId(),this.getUserLoginInfoFromRedis(request).getCompanyInfoVO()));
} }
@ApiOperation(value = "远程查询作业服务") @ApiOperation(value = "远程查询作业服务")
...@@ -93,4 +93,14 @@ public class BackstageTaskServiceController extends BaseController { ...@@ -93,4 +93,14 @@ public class BackstageTaskServiceController extends BaseController {
@ApiParam("分类id") @RequestBody List<Integer> categoriesId) { @ApiParam("分类id") @RequestBody List<Integer> categoriesId) {
return backstageTaskService.getWorkServiceCountByCategoriesId(categoriesId); return backstageTaskService.getWorkServiceCountByCategoriesId(categoriesId);
} }
@ApiOperation(value = "查询作业服务数量——用于后台调用")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("queryWorkServiceCount")
public ResultBody queryWorkServiceCount(
@ApiParam("单位id") @RequestParam(value = "companyId") Integer companyId,HttpServletRequest request) {
return backstageTaskService.queryByIdCount(companyId);
}
} }
package com.mmc.pms.dao; package com.mmc.pms.dao;
import com.mmc.pms.common.ResultBody;
import com.mmc.pms.entity.ServiceDO; import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.model.qo.ServiceQO; import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO; import com.mmc.pms.model.work.dto.ServiceDTO;
...@@ -43,4 +44,6 @@ public interface BackstageTaskServiceDao { ...@@ -43,4 +44,6 @@ public interface BackstageTaskServiceDao {
Integer batchUpAndDownWorkService(@Param("param") UpAndDownServiceVO param); Integer batchUpAndDownWorkService(@Param("param") UpAndDownServiceVO param);
Integer getWorkServiceCountByCategoriesId(@Param("categoriesIds") List<Integer> categoriesIds); Integer getWorkServiceCountByCategoriesId(@Param("categoriesIds") List<Integer> categoriesIds);
Integer queryByIdCount(Integer companyId);
} }
...@@ -62,7 +62,8 @@ public class ServiceDO implements Serializable { ...@@ -62,7 +62,8 @@ public class ServiceDO implements Serializable {
private Integer isDeleted; private Integer isDeleted;
@ApiModelProperty(value = "单位id") @ApiModelProperty(value = "单位id")
private Integer unitId; private Integer companyId;
public ServiceDO(ServiceVO param, Integer accountId) { public ServiceDO(ServiceVO param, Integer accountId) {
this(param); this(param);
...@@ -79,7 +80,7 @@ public class ServiceDO implements Serializable { ...@@ -79,7 +80,7 @@ public class ServiceDO implements Serializable {
this.shareCard = param.getShareCard(); this.shareCard = param.getShareCard();
this.video = param.getVideo(); this.video = param.getVideo();
this.serviceIntroduction = param.getServiceIntroduction(); this.serviceIntroduction = param.getServiceIntroduction();
this.unitId=param.getUnitId(); this.companyId=param.getCompanyId();
} }
public ServiceDO(Integer id, Integer accountId) { public ServiceDO(Integer id, Integer accountId) {
......
...@@ -3,8 +3,11 @@ package com.mmc.pms.feign; ...@@ -3,8 +3,11 @@ package com.mmc.pms.feign;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.mmc.pms.auth.dto.BUserAccountQO; import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.CompanyInfoDTO;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO; import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.hystrix.UserAppApiHystrix; import com.mmc.pms.feign.hystrix.UserAppApiHystrix;
import com.mmc.pms.model.qo.CompanyInfoQO;
import com.mmc.pms.model.qo.UserAccountQO; import com.mmc.pms.model.qo.UserAccountQO;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
...@@ -67,4 +70,17 @@ public interface UserAppApi { ...@@ -67,4 +70,17 @@ public interface UserAppApi {
*/ */
@PostMapping("/userapp/user-account/feignListAppUserAccount") @PostMapping("/userapp/user-account/feignListAppUserAccount")
List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO, @RequestHeader("token") String token); List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO, @RequestHeader("token") String token);
/**
* 获取单位数据
* @param id
* @param token
* @return
*/
@GetMapping("/userapp/company/getCompanyInfoById")
String getCompanyInfoById(@ApiParam(value = "单位", required = true) @RequestParam Integer id, @RequestHeader("token") String token);
@PostMapping("/userapp/company/listCompanyPage")
String listCompanyPage(@ApiParam(value = "单位查询QO", required = true) @RequestBody CompanyInfoQO companyInfoQO, @RequestHeader("token") String token);
} }
package com.mmc.pms.feign.hystrix; package com.mmc.pms.feign.hystrix;
import com.mmc.pms.auth.dto.BUserAccountQO; import com.mmc.pms.auth.dto.BUserAccountQO;
import com.mmc.pms.auth.dto.CompanyInfoDTO;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.auth.dto.UserAccountSimpleDTO; import com.mmc.pms.auth.dto.UserAccountSimpleDTO;
import com.mmc.pms.feign.UserAppApi; import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.CompanyInfoQO;
import com.mmc.pms.model.qo.UserAccountQO; import com.mmc.pms.model.qo.UserAccountQO;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -37,4 +40,16 @@ public class UserAppApiHystrix implements UserAppApi { ...@@ -37,4 +40,16 @@ public class UserAppApiHystrix implements UserAppApi {
log.error("熔断:feignListAppUserAccount:{}", userAccountQO); log.error("熔断:feignListAppUserAccount:{}", userAccountQO);
return null; return null;
} }
@Override
public String getCompanyInfoById(Integer id, String token) {
log.error("熔断:feignListAppUserAccount:{}", id);
return null;
}
@Override
public String listCompanyPage(CompanyInfoQO companyInfoQO, String token) {
log.error("熔断:feignListAppUserAccount:{}", companyInfoQO);
return null;
}
} }
package com.mmc.pms.model.qo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Page;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/**
* @Author small
* @Date 2023/7/4 13:37
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class CompanyInfoQO {
@ApiModelProperty(value = "页码", required = true)
@NotNull(message = "页码不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageNo;
@ApiModelProperty(value = "每页显示数", required = true)
@NotNull(message = "每页显示数不能为空", groups = Page.class)
@Min(value = 1, groups = Page.class)
private Integer pageSize;
}
...@@ -65,4 +65,10 @@ public class ServiceQO implements Serializable { ...@@ -65,4 +65,10 @@ public class ServiceQO implements Serializable {
public void buildCurrentPage() { public void buildCurrentPage() {
this.pageNo = (pageNo - 1) * pageSize; this.pageNo = (pageNo - 1) * pageSize;
} }
@ApiModelProperty(value = "部门id", required = true)
private Integer companyId;
@ApiModelProperty(value = "单位类型,0科比特,1加盟公司", required = true)
private Integer companyType;
} }
...@@ -73,6 +73,12 @@ public class ServiceDTO implements Serializable { ...@@ -73,6 +73,12 @@ public class ServiceDTO implements Serializable {
@ApiModelProperty(value = "修改时间") @ApiModelProperty(value = "修改时间")
private Date updateTime; private Date updateTime;
@ApiModelProperty(value = "单位id")
private Integer companyId;
@ApiModelProperty(value = "单位名称")
private String companyName;
public ServiceDTO(ServiceVO param, Integer accountId) { public ServiceDTO(ServiceVO param, Integer accountId) {
this.id = param.getId(); this.id = param.getId();
this.serviceName = param.getServiceName(); this.serviceName = param.getServiceName();
...@@ -116,6 +122,24 @@ public class ServiceDTO implements Serializable { ...@@ -116,6 +122,24 @@ public class ServiceDTO implements Serializable {
this.accountId = serviceDO.getAccountId(); this.accountId = serviceDO.getAccountId();
this.createTime = serviceDO.getCreateTime(); this.createTime = serviceDO.getCreateTime();
this.updateTime = serviceDO.getUpdateTime(); this.updateTime = serviceDO.getUpdateTime();
this.companyId=serviceDO.getCompanyId();
}
public ServiceDTO(ServiceDO serviceDO,String companyName) {
this.id = serviceDO.getId();
this.serviceName = serviceDO.getServiceName();
this.applicationId = serviceDO.getApplicationId();
this.industryId = serviceDO.getIndustryId();
this.displayState = serviceDO.getDisplayState();
this.coverPlan = serviceDO.getCoverPlan();
this.shareCard = serviceDO.getShareCard();
this.video = serviceDO.getVideo();
this.serviceIntroduction = serviceDO.getServiceIntroduction();
this.accountId = serviceDO.getAccountId();
this.createTime = serviceDO.getCreateTime();
this.updateTime = serviceDO.getUpdateTime();
this.companyId=serviceDO.getCompanyId();
this.companyName=companyName;
} }
} }
...@@ -45,9 +45,12 @@ public class WorkServiceDTO implements Serializable { ...@@ -45,9 +45,12 @@ public class WorkServiceDTO implements Serializable {
@ApiModelProperty(value = "服务介绍") @ApiModelProperty(value = "服务介绍")
private String serviceIntroduction; private String serviceIntroduction;
@ApiModelProperty(value = "公司名称") @ApiModelProperty(value = "部门名称")
private String companyName; private String companyName;
@ApiModelProperty(value = "部门id")
private Integer companyId;
@ApiModelProperty(value = "评论列表") @ApiModelProperty(value = "评论列表")
private List<InspComtDO> inspComtList; private List<InspComtDO> inspComtList;
......
...@@ -69,5 +69,5 @@ public class ServiceVO implements Serializable { ...@@ -69,5 +69,5 @@ public class ServiceVO implements Serializable {
private String serviceIntroduction; private String serviceIntroduction;
@ApiModelProperty(value = "单位id") @ApiModelProperty(value = "单位id")
private Integer unitId; private Integer companyId;
} }
package com.mmc.pms.service; package com.mmc.pms.service;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.model.qo.ServiceQO; import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO; import com.mmc.pms.model.work.dto.ServiceDTO;
...@@ -22,9 +23,9 @@ public interface BackstageTaskService { ...@@ -22,9 +23,9 @@ public interface BackstageTaskService {
ResultBody deleteByIds(List<Integer> ids); ResultBody deleteByIds(List<Integer> ids);
ResultBody<ServiceDTO> queryById(Integer id); ResultBody<ServiceDTO> queryById(Integer id,HttpServletRequest request);
PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId); PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId, CompanyInfoVO companyInfoDTO);
PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request); PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request);
...@@ -33,4 +34,6 @@ public interface BackstageTaskService { ...@@ -33,4 +34,6 @@ public interface BackstageTaskService {
ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param); ResultBody batchUpAndDownWorkService(UpAndDownServiceVO param);
Integer getWorkServiceCountByCategoriesId(List<Integer> ids); Integer getWorkServiceCountByCategoriesId(List<Integer> ids);
ResultBody queryByIdCount(Integer id);
} }
package com.mmc.pms.service.Impl; package com.mmc.pms.service.Impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.aliyun.oss.HttpMethod;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import com.mmc.pms.auth.dto.CompanyInfoDTO;
import com.mmc.pms.auth.dto.CompanyInfoVO;
import com.mmc.pms.common.ResultBody; import com.mmc.pms.common.ResultBody;
import com.mmc.pms.constant.DateConstant; import com.mmc.pms.constant.DateConstant;
import com.mmc.pms.dao.BackstageTaskServiceDao; import com.mmc.pms.dao.BackstageTaskServiceDao;
...@@ -10,6 +16,7 @@ import com.mmc.pms.entity.Categories; ...@@ -10,6 +16,7 @@ import com.mmc.pms.entity.Categories;
import com.mmc.pms.entity.InspComtDO; import com.mmc.pms.entity.InspComtDO;
import com.mmc.pms.entity.ServiceDO; import com.mmc.pms.entity.ServiceDO;
import com.mmc.pms.feign.UserAppApi; import com.mmc.pms.feign.UserAppApi;
import com.mmc.pms.model.qo.CompanyInfoQO;
import com.mmc.pms.model.qo.ServiceQO; import com.mmc.pms.model.qo.ServiceQO;
import com.mmc.pms.model.work.dto.ServiceDTO; import com.mmc.pms.model.work.dto.ServiceDTO;
import com.mmc.pms.model.work.dto.WorkServiceDTO; import com.mmc.pms.model.work.dto.WorkServiceDTO;
...@@ -18,14 +25,21 @@ import com.mmc.pms.model.work.vo.UpAndDownServiceVO; ...@@ -18,14 +25,21 @@ import com.mmc.pms.model.work.vo.UpAndDownServiceVO;
import com.mmc.pms.page.PageResult; import com.mmc.pms.page.PageResult;
import com.mmc.pms.service.BackstageTaskService; import com.mmc.pms.service.BackstageTaskService;
import com.mmc.pms.service.InspComtService; import com.mmc.pms.service.InspComtService;
import feign.Feign;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.RandomUtils; import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.MultiValueMap;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.text.ParseException; import java.text.ParseException;
...@@ -51,6 +65,7 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -51,6 +65,7 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
@Autowired private RedisTemplate redisTemplate; @Autowired private RedisTemplate redisTemplate;
@Override @Override
public ResultBody addWorkService(ServiceVO param, Integer userAccountId) { public ResultBody addWorkService(ServiceVO param, Integer userAccountId) {
ServiceDO serviceDO = new ServiceDO(param, userAccountId); ServiceDO serviceDO = new ServiceDO(param, userAccountId);
...@@ -74,9 +89,13 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -74,9 +89,13 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
} }
@Override @Override
public ResultBody<ServiceDTO> queryById(Integer id) { public ResultBody<ServiceDTO> queryById(Integer id,HttpServletRequest request) {
ServiceDO serviceDO = backstageTaskServiceDao.queryById(id); ServiceDO serviceDO = backstageTaskServiceDao.queryById(id);
ServiceDTO serviceDTO = new ServiceDTO(serviceDO); String token = userAppApi.getCompanyInfoById(serviceDO.getCompanyId(), request.getHeader("token"));
JSONObject jsonObject = JSONObject.parseObject(token);
CompanyInfoDTO companyInfoDTO = JSON.parseObject(String.valueOf((JSONObject) jsonObject.get("result")), CompanyInfoDTO.class);
String companyName = companyInfoDTO.getCompanyName();
ServiceDTO serviceDTO = new ServiceDTO(serviceDO,companyName);
Map<Integer, String> categoriesNameMap = Map<Integer, String> categoriesNameMap =
getCategoriesNameByIds( getCategoriesNameByIds(
Arrays.asList(serviceDTO.getApplicationId(), serviceDTO.getIndustryId())); Arrays.asList(serviceDTO.getApplicationId(), serviceDTO.getIndustryId()));
...@@ -90,6 +109,8 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -90,6 +109,8 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
return ResultBody.success(serviceDTO); return ResultBody.success(serviceDTO);
} }
private Map<Integer, String> getCategoriesNameByIds(List<Integer> ids) { private Map<Integer, String> getCategoriesNameByIds(List<Integer> ids) {
if (CollectionUtils.isEmpty(ids)) { if (CollectionUtils.isEmpty(ids)) {
return new HashMap<>(); return new HashMap<>();
...@@ -107,13 +128,15 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -107,13 +128,15 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
} }
@Override @Override
public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId) { public PageResult queryServiceManagerList(ServiceQO param, Integer userAccountId, CompanyInfoVO companyInfoVO) {
int count = backstageTaskServiceDao.count(param); int count = backstageTaskServiceDao.count(param);
if (count == 0) { if (count == 0) {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count); return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
} }
Integer pageNo = param.getPageNo(); Integer pageNo = param.getPageNo();
param.buildCurrentPage(); param.buildCurrentPage();
param.setCompanyId(companyInfoVO.getId());
param.setCompanyType(companyInfoVO.getCompanyType());
List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param); List<ServiceDO> services = backstageTaskServiceDao.queryAllByLimit(param);
List<ServiceDTO> pageList = setApplicationNameAndIndustryName(services); List<ServiceDTO> pageList = setApplicationNameAndIndustryName(services);
return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList); return PageResult.buildPage(pageNo, param.getPageSize(), count, pageList);
...@@ -140,6 +163,7 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -140,6 +163,7 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
} }
@Override @Override
@Transactional
public PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request) { public PageResult queryWorkServiceList(ServiceQO param, HttpServletRequest request) {
Integer pageNo = param.getPageNo(); Integer pageNo = param.getPageNo();
param.buildCurrentPage(); param.buildCurrentPage();
...@@ -157,9 +181,9 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -157,9 +181,9 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count); return PageResult.buildPage(param.getPageNo(), param.getPageSize(), count);
} }
List<ServiceDO> pageList = List<ServiceDO> pageList =
backstageTaskServiceDao.queryPageByLimit(param, categoriesIds, userIds); backstageTaskServiceDao.queryPageByLimit(param, categoriesIds, userIds);
List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList); List<WorkServiceDTO> workServiceDTOList = getWorkServiceDTOS(pageList,request);
return PageResult.buildPage(pageNo, param.getPageSize(), count, workServiceDTOList); return PageResult.buildPage(pageNo, param.getPageSize(), count, workServiceDTOList);
} }
...@@ -184,16 +208,30 @@ public class BackstageTaskServiceImpl implements BackstageTaskService { ...@@ -184,16 +208,30 @@ public class BackstageTaskServiceImpl implements BackstageTaskService {
return backstageTaskServiceDao.getWorkServiceCountByCategoriesId(ids); return backstageTaskServiceDao.getWorkServiceCountByCategoriesId(ids);
} }
private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList) { @Override
// 用户暂时无关联公司数据,先用假数据展示 public ResultBody queryByIdCount(Integer companyId) {
String companyName = "浙江科比特创新科技有限公司"; return ResultBody.success(backstageTaskServiceDao.queryByIdCount( companyId));
}
private List<WorkServiceDTO> getWorkServiceDTOS(List<ServiceDO> pageList,HttpServletRequest request) {
String companyInfoVOS= userAppApi.listCompanyPage(new CompanyInfoQO(1, 100000), request.getHeader("token") );
JSONObject jsonObject = JSON.parseObject(companyInfoVOS);
JSONObject jsonObject1 = JSON.parseObject(String.valueOf(jsonObject.get("result")));
List<CompanyInfoVO> companyInfoList = new Gson().fromJson(new Gson().toJson(jsonObject1.get("list")), new TypeToken<List<CompanyInfoVO>>(){}.getType());
String companyName = "";
List<WorkServiceDTO> workServiceDTOList = new ArrayList<>(); List<WorkServiceDTO> workServiceDTOList = new ArrayList<>();
for (ServiceDO item : pageList) { for (ServiceDO item : pageList) {
for (CompanyInfoVO companyInfoVO : companyInfoList) {
if (item.getCompanyId().equals(companyInfoVO.getId())){
companyName=companyInfoVO.getCompanyName();
}
}
List<InspComtDO> inspComtDOS = generateComments(item); List<InspComtDO> inspComtDOS = generateComments(item);
WorkServiceDTO workServiceDTO = WorkServiceDTO workServiceDTO =
WorkServiceDTO.builder() WorkServiceDTO.builder()
.id(item.getId()) .id(item.getId())
.serviceName(item.getServiceName()) .serviceName(item.getServiceName())
.companyId(item.getCompanyId())
.companyName(companyName) .companyName(companyName)
.coverPlan(item.getCoverPlan()) .coverPlan(item.getCoverPlan())
.serviceIntroduction(item.getServiceIntroduction()) .serviceIntroduction(item.getServiceIntroduction())
......
...@@ -7,8 +7,7 @@ spring: ...@@ -7,8 +7,7 @@ spring:
password: MMC@2022&MYSQL password: MMC@2022&MYSQL
redis: redis:
database: 1 database: 1
host: r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com host: 127.0.0.1
password: MMC@2022&REDIS
port: 6379 port: 6379
#连接池 #连接池
lettuce: lettuce:
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/> <result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
<result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/> <result property="isDeleted" column="is_deleted" jdbcType="INTEGER"/>
<result property="accountId" column="account_id" jdbcType="INTEGER"/> <result property="accountId" column="account_id" jdbcType="INTEGER"/>
<result property="companyId" column="company_id" jdbcType="INTEGER"/>
</resultMap> </resultMap>
<!--查询所有--> <!--查询所有-->
...@@ -51,8 +52,9 @@ ...@@ -51,8 +52,9 @@
service_introduction, service_introduction,
create_time, create_time,
update_time, update_time,
account_id account_id,
from service company_id
from service
where id = #{id} where id = #{id}
and is_deleted = 0 and is_deleted = 0
</select> </select>
...@@ -61,7 +63,7 @@ ...@@ -61,7 +63,7 @@
<select id="queryAllByLimit" resultMap="ServiceMap" parameterType="com.mmc.pms.model.qo.ServiceQO"> <select id="queryAllByLimit" resultMap="ServiceMap" parameterType="com.mmc.pms.model.qo.ServiceQO">
select select
id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video, id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, create_time, update_time, account_id service_introduction, create_time, update_time, account_id,company_id
from service from service
<where> <where>
is_deleted = 0 is_deleted = 0
...@@ -77,6 +79,9 @@ ...@@ -77,6 +79,9 @@
<if test="displayState != null"> <if test="displayState != null">
and display_state = #{displayState} and display_state = #{displayState}
</if> </if>
<if test="companyType==1 and companyId!=null">
and company_id = #{companyId}
</if>
</where> </where>
order by create_time desc order by create_time desc
limit #{pageNo}, #{pageSize} limit #{pageNo}, #{pageSize}
...@@ -106,9 +111,9 @@ ...@@ -106,9 +111,9 @@
<!--新增所有列--> <!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.pms.entity.ServiceDO"> <insert id="insert" keyProperty="id" useGeneratedKeys="true" parameterType="com.mmc.pms.entity.ServiceDO">
insert into service(service_name, application_id, industry_id, display_state, cover_plan, share_card, video, insert into service(service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, account_id,unit_id) service_introduction, account_id,company_id)
values (#{serviceName}, #{applicationId}, #{industryId}, #{displayState}, #{coverPlan}, #{shareCard}, values (#{serviceName}, #{applicationId}, #{industryId}, #{displayState}, #{coverPlan}, #{shareCard},
#{video}, #{serviceIntroduction}, #{accountId},#{unitId}) #{video}, #{serviceIntroduction}, #{accountId},#{companyId})
</insert> </insert>
<!--通过主键修改数据--> <!--通过主键修改数据-->
...@@ -148,8 +153,8 @@ ...@@ -148,8 +153,8 @@
<if test="accountId != null"> <if test="accountId != null">
account_id = #{accountId}, account_id = #{accountId},
</if> </if>
<if test="unitId != null"> <if test="companyId != null">
unit_id = #{unitId}, company_id = #{companyId},
</if> </if>
</set> </set>
where id = #{id} where id = #{id}
...@@ -203,7 +208,7 @@ ...@@ -203,7 +208,7 @@
<select id="queryPageByLimit" resultType="com.mmc.pms.entity.ServiceDO"> <select id="queryPageByLimit" resultType="com.mmc.pms.entity.ServiceDO">
select select
id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video, id, service_name, application_id, industry_id, display_state, cover_plan, share_card, video,
service_introduction, create_time, update_time, account_id service_introduction, create_time, update_time, account_id,company_id
from service from service
<where> <where>
is_deleted = 0 and display_state = 0 is_deleted = 0 and display_state = 0
...@@ -286,4 +291,8 @@ ...@@ -286,4 +291,8 @@
</if> </if>
</where> </where>
</select> </select>
<select id="queryByIdCount" resultType="java.lang.Integer">
select count(1) from service where company_id=#{companyId}
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论