@@ -1,144 +1,162 @@ | |||||
//package com.ningdatech.pmapi.ding.task; | |||||
// | |||||
//import cn.hutool.core.collection.CollUtil; | |||||
//import com.ningdatech.basic.model.GenericResult; | |||||
//import com.ningdatech.pmapi.organization.entity.DingEmployeeInfo; | |||||
//import com.ningdatech.pmapi.organization.entity.DingOrganization; | |||||
//import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | |||||
//import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
//import com.ningdatech.zwdd.client.ZwddClient; | |||||
//import com.ningdatech.zwdd.model.Page; | |||||
//import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; | |||||
//import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; | |||||
//import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; | |||||
//import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; | |||||
//import org.springframework.beans.BeanUtils; | |||||
//import org.springframework.beans.factory.annotation.Autowired; | |||||
//import org.springframework.stereotype.Component; | |||||
//import org.springframework.transaction.annotation.Transactional; | |||||
// | |||||
//import java.util.ArrayList; | |||||
//import java.util.List; | |||||
//import java.util.stream.Collectors; | |||||
// | |||||
///** | |||||
// * @author liuxinxin | |||||
// * @date 2023/2/10 上午9:52 | |||||
// */ | |||||
// | |||||
//@Component | |||||
//public class EmployeeBatchGetTask { | |||||
// | |||||
// private final static Integer PAGE_SIZE = 20; | |||||
// | |||||
// private final static Integer GROUP_SIZE = 100; | |||||
// | |||||
// @Autowired | |||||
// private ZwddClient zwddClient; | |||||
// | |||||
// @Autowired | |||||
// private IDingOrganizationService iDingOrganizationService; | |||||
// | |||||
// @Autowired | |||||
// private IDingEmployeeInfoService iDingEmployeeInfoService; | |||||
// | |||||
// @Transactional(rollbackFor = Exception.class) | |||||
// public void batchGetEmployeeTask() { | |||||
// | |||||
// // 获取所有的组织列表用户获取组织下的 用户信息 | |||||
// List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(); | |||||
// if (CollUtil.isNotEmpty(dingOrganizationList)) { | |||||
// for (DingOrganization dingOrganization : dingOrganizationList) { | |||||
// List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>(); | |||||
// String organizationCode = dingOrganization.getOrganizationCode(); | |||||
// PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); | |||||
// query.setEmployeeStatus("A"); | |||||
// query.setOrganizationCode(organizationCode); | |||||
// query.setReturnTotalSize(true); | |||||
//// query.setTenantId(GovDingProperties.tenantId); | |||||
// int pageNo = 1; | |||||
// query.setPageNo(pageNo); | |||||
// query.setPageSize(PAGE_SIZE); | |||||
// | |||||
// // 查询组织下 用户信息 | |||||
// GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||||
// Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData(); | |||||
// if (CollUtil.isNotEmpty(data.getData())) { | |||||
// | |||||
// allOrganizationEmployeePositionList.addAll(data.getData()); | |||||
// } | |||||
// Long totalSize = data.getTotalSize(); | |||||
// if (totalSize > PAGE_SIZE) { | |||||
// int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE); | |||||
// for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { | |||||
// query.setPageNo(maxPageNo); | |||||
// GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||||
// if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) { | |||||
// allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); | |||||
// } | |||||
// } | |||||
// } | |||||
// | |||||
// List<DingEmployeeInfo> dingEmployeeInfoList = new ArrayList<>(); | |||||
// if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { | |||||
// List<String> employeeCodes = allOrganizationEmployeePositionList.stream().map(OrganizationEmployeePosition::getEmployeeCode).collect(Collectors.toList()); | |||||
// GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); | |||||
//// List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData(); | |||||
// } else { | |||||
//// iDingEmployeeInfoService.saveBatch(); | |||||
// } | |||||
// // 批量保存用户信息 | |||||
// saveBatch(allOrganizationEmployeePositionList); | |||||
// } | |||||
// | |||||
// } | |||||
// | |||||
// | |||||
// } | |||||
// | |||||
// private List<DingEmployeeInfo> buildDingEmployeeInfoRecord(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) { | |||||
// List<DingEmployeeInfo> saveRecordList = new ArrayList<>(); | |||||
// for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { | |||||
// List<GovEmployeePosition> govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); | |||||
// if (CollUtil.isNotEmpty(govEmployeePositions)) { | |||||
// List<DingEmployeeInfo> segmentSaveRecordList = new ArrayList<>(); | |||||
// for (GovEmployeePosition govEmployeePosition : govEmployeePositions) { | |||||
// DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); | |||||
// BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); | |||||
// dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); | |||||
// dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); | |||||
// dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); | |||||
// dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); | |||||
// dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); | |||||
// dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); | |||||
// dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); | |||||
// dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); | |||||
// dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); | |||||
// segmentSaveRecordList.add(dingEmployeeInfo); | |||||
// } | |||||
// saveRecordList.addAll(segmentSaveRecordList); | |||||
// } else { | |||||
// DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); | |||||
// BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); | |||||
// saveRecordList.add(dingEmployeeInfo); | |||||
// } | |||||
// | |||||
// | |||||
// } | |||||
// return null; | |||||
// } | |||||
// | |||||
// private void saveBatch(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) { | |||||
// | |||||
//// // 批量保存 | |||||
//// if (saveRecordList.size() <= GROUP_SIZE) { | |||||
//// iDingOrganizationService.saveBatch(saveRecordList); | |||||
//// } else { | |||||
//// List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE); | |||||
//// for (List<DingOrganization> segment : split) { | |||||
//// iDingOrganizationService.saveBatch(segment); | |||||
//// } | |||||
//// } | |||||
// | |||||
// } | |||||
//} | |||||
package com.ningdatech.pmapi.ding.task; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.model.GenericResult; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.service.IDingEmployeeInfoService; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import com.ningdatech.zwdd.ZwddIntegrationProperties; | |||||
import com.ningdatech.zwdd.client.ZwddClient; | |||||
import com.ningdatech.zwdd.model.Page; | |||||
import com.ningdatech.zwdd.model.dto.EmployeeAccountIdDTO; | |||||
import com.ningdatech.zwdd.model.query.PageOrganizationEmployeePositionsQuery; | |||||
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition; | |||||
import com.ningdatech.zwdd.model.response.OrganizationEmployeePosition.GovEmployeePosition; | |||||
import org.springframework.beans.BeanUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.stereotype.Component; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
import java.util.Map; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* @author liuxinxin | |||||
* @date 2023/2/10 上午9:52 | |||||
*/ | |||||
@Component | |||||
public class EmployeeBatchGetTask { | |||||
private final static Integer PAGE_SIZE = 20; | |||||
private final static Integer GROUP_SIZE = 100; | |||||
@Autowired | |||||
private ZwddClient zwddClient; | |||||
@Autowired | |||||
private IDingOrganizationService iDingOrganizationService; | |||||
@Autowired | |||||
private IDingEmployeeInfoService iDingEmployeeInfoService; | |||||
@Autowired | |||||
private ZwddIntegrationProperties zwddIntegrationProperties; | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void batchGetEmployeeTask() { | |||||
// 获取所有的组织列表用户获取组织下的 用户信息 | |||||
List<DingOrganization> dingOrganizationList = iDingOrganizationService.list(); | |||||
if (CollUtil.isNotEmpty(dingOrganizationList)) { | |||||
for (DingOrganization dingOrganization : dingOrganizationList) { | |||||
List<OrganizationEmployeePosition> allOrganizationEmployeePositionList = new ArrayList<>(); | |||||
String organizationCode = dingOrganization.getOrganizationCode(); | |||||
PageOrganizationEmployeePositionsQuery query = new PageOrganizationEmployeePositionsQuery(); | |||||
query.setEmployeeStatus("A"); | |||||
query.setOrganizationCode(organizationCode); | |||||
query.setReturnTotalSize(true); | |||||
query.setTenantId(zwddIntegrationProperties.getTenantId()); | |||||
int pageNo = 1; | |||||
query.setPageNo(pageNo); | |||||
query.setPageSize(PAGE_SIZE); | |||||
// 查询组织下 用户信息 | |||||
GenericResult<Page<OrganizationEmployeePosition>> firstPageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||||
Page<OrganizationEmployeePosition> data = firstPageGenericResult.getData(); | |||||
if (CollUtil.isNotEmpty(data.getData())) { | |||||
allOrganizationEmployeePositionList.addAll(data.getData()); | |||||
} | |||||
Long totalSize = data.getTotalSize(); | |||||
if (totalSize > PAGE_SIZE) { | |||||
int maxPageNo = (int) Math.ceil(totalSize / PAGE_SIZE); | |||||
for (pageNo = 2; pageNo <= maxPageNo; pageNo++) { | |||||
query.setPageNo(maxPageNo); | |||||
GenericResult<Page<OrganizationEmployeePosition>> pageGenericResult = zwddClient.pageOrganizationEmployeePositions(query); | |||||
if (CollUtil.isNotEmpty(pageGenericResult.getData().getData())) { | |||||
allOrganizationEmployeePositionList.addAll(pageGenericResult.getData().getData()); | |||||
} | |||||
} | |||||
} | |||||
// 批量查询 成员的accountId | |||||
List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList = new ArrayList<>(); | |||||
if (allOrganizationEmployeePositionList.size() <= GROUP_SIZE) { | |||||
assemblerAccountId(allOrganizationEmployeePositionList, dingEmployeeInfoSaveRecordList); | |||||
} else { | |||||
List<List<OrganizationEmployeePosition>> split = Lists.partition(allOrganizationEmployeePositionList, GROUP_SIZE); | |||||
for (List<OrganizationEmployeePosition> segment : split) { | |||||
assemblerAccountId(segment, dingEmployeeInfoSaveRecordList); | |||||
} | |||||
} | |||||
// 批量保存用户信息 | |||||
saveBatch(dingEmployeeInfoSaveRecordList); | |||||
} | |||||
} | |||||
} | |||||
private void assemblerAccountId(List<OrganizationEmployeePosition> segment, List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList) { | |||||
List<String> employeeCodes = segment.stream().map(OrganizationEmployeePosition::getEmployeeCode).distinct().collect(Collectors.toList()); | |||||
GenericResult<List<EmployeeAccountIdDTO>> listGenericResult = zwddClient.listEmployeeAccountIds(employeeCodes); | |||||
List<EmployeeAccountIdDTO> employeeAccountIdDTOList = listGenericResult.getData(); | |||||
Map<String, Long> employeeCodeAccountIdMap = employeeAccountIdDTOList.stream() | |||||
.collect(Collectors.toMap(EmployeeAccountIdDTO::getEmployeeCode, EmployeeAccountIdDTO::getAccountId)); | |||||
List<DingEmployeeInfo> dingEmployeeInfos = buildDingEmployeeInfoRecordList(segment); | |||||
dingEmployeeInfos = dingEmployeeInfos.stream().map(r -> { | |||||
r.setAccountId(employeeCodeAccountIdMap.get(r.getEmployeeCode())); | |||||
return r; | |||||
}).collect(Collectors.toList()); | |||||
dingEmployeeInfoSaveRecordList.addAll(dingEmployeeInfos); | |||||
} | |||||
private List<DingEmployeeInfo> buildDingEmployeeInfoRecordList(List<OrganizationEmployeePosition> allOrganizationEmployeePositionList) { | |||||
List<DingEmployeeInfo> saveRecordList = new ArrayList<>(); | |||||
for (OrganizationEmployeePosition organizationEmployeePosition : allOrganizationEmployeePositionList) { | |||||
List<GovEmployeePosition> govEmployeePositions = organizationEmployeePosition.getGovEmployeePositions(); | |||||
if (CollUtil.isNotEmpty(govEmployeePositions)) { | |||||
List<DingEmployeeInfo> segmentSaveRecordList = new ArrayList<>(); | |||||
for (GovEmployeePosition govEmployeePosition : govEmployeePositions) { | |||||
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); | |||||
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); | |||||
dingEmployeeInfo.setMainJob(govEmployeePosition.getMainJob()); | |||||
dingEmployeeInfo.setEmpPosUnitCode(govEmployeePosition.getEmpPosUnitCode()); | |||||
dingEmployeeInfo.setEmpPosEmployeeRoleCode(govEmployeePosition.getEmpPosEmployeeRoleCode()); | |||||
dingEmployeeInfo.setEmpPosInnerInstitutionCode(govEmployeePosition.getEmpPosInnerInstitutionCode()); | |||||
dingEmployeeInfo.setEmployeeCode(govEmployeePosition.getEmployeeCode()); | |||||
dingEmployeeInfo.setJobAttributesCode(govEmployeePosition.getJobAttributesCode()); | |||||
dingEmployeeInfo.setOrganizationCode(govEmployeePosition.getOrganizationCode()); | |||||
dingEmployeeInfo.setEmpPosVirtualOrganizationCode(govEmployeePosition.getEmpPosVirtualOrganizationCode()); | |||||
dingEmployeeInfo.setEmpStatus(govEmployeePosition.getStatus()); | |||||
segmentSaveRecordList.add(dingEmployeeInfo); | |||||
} | |||||
saveRecordList.addAll(segmentSaveRecordList); | |||||
} else { | |||||
DingEmployeeInfo dingEmployeeInfo = new DingEmployeeInfo(); | |||||
BeanUtils.copyProperties(organizationEmployeePosition, dingEmployeeInfo); | |||||
saveRecordList.add(dingEmployeeInfo); | |||||
} | |||||
} | |||||
return saveRecordList; | |||||
} | |||||
private void saveBatch(List<DingEmployeeInfo> dingEmployeeInfoSaveRecordList) { | |||||
if (dingEmployeeInfoSaveRecordList.size() <= GROUP_SIZE) { | |||||
iDingEmployeeInfoService.saveBatch(dingEmployeeInfoSaveRecordList); | |||||
} else { | |||||
List<List<DingEmployeeInfo>> split = Lists.partition(dingEmployeeInfoSaveRecordList, GROUP_SIZE); | |||||
for (List<DingEmployeeInfo> segment : split) { | |||||
iDingEmployeeInfoService.saveBatch(segment); | |||||
} | |||||
} | |||||
} | |||||
} |
@@ -1,10 +1,15 @@ | |||||
package com.ningdatech.pmapi.expert.controller; | package com.ningdatech.pmapi.expert.controller; | ||||
import com.ningdatech.pmapi.expert.manage.ReviewTemplateSettingsManage; | |||||
import com.ningdatech.pmapi.expert.model.req.ReviewTemplateReq; | |||||
import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; | |||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.AllArgsConstructor; | import lombok.AllArgsConstructor; | ||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import org.springframework.web.bind.annotation.*; | |||||
import javax.validation.Valid; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
@@ -20,4 +25,18 @@ import org.springframework.web.bind.annotation.RestController; | |||||
@RequestMapping("/api/v1/reviewTemplateSettings") | @RequestMapping("/api/v1/reviewTemplateSettings") | ||||
public class ReviewTemplateSettingsController { | public class ReviewTemplateSettingsController { | ||||
private final ReviewTemplateSettingsManage reviewTemplateSettingsManage; | |||||
@GetMapping("/template/{templateType}") | |||||
@ApiOperation("根据模版类型获取模版") | |||||
public ReviewTemplateVO getReviewTemplateByType(@PathVariable Integer templateType) { | |||||
return reviewTemplateSettingsManage.getReviewTemplateSettings(templateType); | |||||
} | |||||
@PostMapping("/modify") | |||||
@ApiOperation("修改或保存模版配置") | |||||
public void modifyReviewTemplateSettings(@RequestBody @Valid ReviewTemplateReq req) { | |||||
reviewTemplateSettingsManage.saveOrUpdate(req); | |||||
} | |||||
} | } |
@@ -0,0 +1,63 @@ | |||||
package com.ningdatech.pmapi.expert.manage; | |||||
import cn.hutool.json.JSONUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.ningdatech.basic.exception.BizException; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; | |||||
import com.ningdatech.pmapi.expert.model.entity.ReviewTemplateSettings; | |||||
import com.ningdatech.pmapi.expert.model.req.ReviewTemplateReq; | |||||
import com.ningdatech.pmapi.expert.model.vo.ReviewTemplateVO; | |||||
import com.ningdatech.pmapi.expert.service.IReviewTemplateSettingsService; | |||||
import lombok.AllArgsConstructor; | |||||
import org.springframework.stereotype.Component; | |||||
import org.springframework.transaction.annotation.Transactional; | |||||
/** | |||||
* <p> | |||||
* ReviewTemplateSettingsManage | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 09:41 2023/2/15 | |||||
*/ | |||||
@Component | |||||
@AllArgsConstructor | |||||
public class ReviewTemplateSettingsManage { | |||||
private final IReviewTemplateSettingsService reviewTemplateSettingsService; | |||||
@Transactional(rollbackFor = Exception.class) | |||||
public void saveOrUpdate(ReviewTemplateReq req) { | |||||
LambdaUpdateWrapper<ReviewTemplateSettings> update = Wrappers.lambdaUpdate(ReviewTemplateSettings.class) | |||||
.eq(ReviewTemplateSettings::getTemplateType, req.getTemplateType()) | |||||
.eq(ReviewTemplateSettings::getIsLast, Boolean.TRUE) | |||||
.set(ReviewTemplateSettings::getIsLast, Boolean.FALSE) | |||||
.last(BizConst.LIMIT_1); | |||||
reviewTemplateSettingsService.update(update); | |||||
ReviewTemplateSettings settings = new ReviewTemplateSettings(); | |||||
settings.setTemplateType(req.getTemplateType()); | |||||
settings.setIsLast(Boolean.TRUE); | |||||
settings.setContent(JSONUtil.toJsonStr(req.getTemplates())); | |||||
reviewTemplateSettingsService.save(settings); | |||||
} | |||||
public ReviewTemplateVO getReviewTemplateSettings(Integer templateType) { | |||||
LambdaQueryWrapper<ReviewTemplateSettings> query = Wrappers.lambdaQuery(ReviewTemplateSettings.class) | |||||
.eq(ReviewTemplateSettings::getIsLast, Boolean.TRUE) | |||||
.eq(ReviewTemplateSettings::getTemplateType, templateType) | |||||
.last(BizConst.LIMIT_1); | |||||
ReviewTemplateSettings settings = reviewTemplateSettingsService.getOne(query); | |||||
if (settings == null) { | |||||
throw BizException.wrap("模版不存在"); | |||||
} | |||||
return ReviewTemplateVO.builder() | |||||
.templateId(settings.getId()) | |||||
.templateType(settings.getTemplateType()) | |||||
.templates(JSONUtil.toList(settings.getContent(), ReviewTemplateSettingsDTO.class)) | |||||
.build(); | |||||
} | |||||
} |
@@ -1,11 +1,14 @@ | |||||
package com.ningdatech.pmapi.expert.model.entity; | package com.ningdatech.pmapi.expert.model.entity; | ||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* 评审模版配置表 | * 评审模版配置表 | ||||
@@ -21,6 +24,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
@ApiModelProperty("主键") | @ApiModelProperty("主键") | ||||
@TableId(type = IdType.AUTO) | |||||
private Long id; | private Long id; | ||||
@ApiModelProperty("模版类型:1 初步方案评审模版、2 建设方案评审模版、3 验收方案评审模版") | @ApiModelProperty("模版类型:1 初步方案评审模版、2 建设方案评审模版、3 验收方案评审模版") | ||||
@@ -47,6 +51,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setId(Long id) { | public void setId(Long id) { | ||||
this.id = id; | this.id = id; | ||||
} | } | ||||
public Integer getTemplateType() { | public Integer getTemplateType() { | ||||
return templateType; | return templateType; | ||||
} | } | ||||
@@ -54,6 +59,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setTemplateType(Integer templateType) { | public void setTemplateType(Integer templateType) { | ||||
this.templateType = templateType; | this.templateType = templateType; | ||||
} | } | ||||
public String getContent() { | public String getContent() { | ||||
return content; | return content; | ||||
} | } | ||||
@@ -61,6 +67,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setContent(String content) { | public void setContent(String content) { | ||||
this.content = content; | this.content = content; | ||||
} | } | ||||
public Long getCreateBy() { | public Long getCreateBy() { | ||||
return createBy; | return createBy; | ||||
} | } | ||||
@@ -68,6 +75,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setCreateBy(Long createBy) { | public void setCreateBy(Long createBy) { | ||||
this.createBy = createBy; | this.createBy = createBy; | ||||
} | } | ||||
public Long getUpdateBy() { | public Long getUpdateBy() { | ||||
return updateBy; | return updateBy; | ||||
} | } | ||||
@@ -75,6 +83,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setUpdateBy(Long updateBy) { | public void setUpdateBy(Long updateBy) { | ||||
this.updateBy = updateBy; | this.updateBy = updateBy; | ||||
} | } | ||||
public LocalDateTime getCreateOn() { | public LocalDateTime getCreateOn() { | ||||
return createOn; | return createOn; | ||||
} | } | ||||
@@ -82,6 +91,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setCreateOn(LocalDateTime createOn) { | public void setCreateOn(LocalDateTime createOn) { | ||||
this.createOn = createOn; | this.createOn = createOn; | ||||
} | } | ||||
public LocalDateTime getUpdateOn() { | public LocalDateTime getUpdateOn() { | ||||
return updateOn; | return updateOn; | ||||
} | } | ||||
@@ -89,6 +99,7 @@ public class ReviewTemplateSettings implements Serializable { | |||||
public void setUpdateOn(LocalDateTime updateOn) { | public void setUpdateOn(LocalDateTime updateOn) { | ||||
this.updateOn = updateOn; | this.updateOn = updateOn; | ||||
} | } | ||||
public Boolean getIsLast() { | public Boolean getIsLast() { | ||||
return isLast; | return isLast; | ||||
} | } | ||||
@@ -100,14 +111,14 @@ public class ReviewTemplateSettings implements Serializable { | |||||
@Override | @Override | ||||
public String toString() { | public String toString() { | ||||
return "NdReviewTemplateSettings{" + | return "NdReviewTemplateSettings{" + | ||||
"id=" + id + | |||||
", templateType=" + templateType + | |||||
", content=" + content + | |||||
", createBy=" + createBy + | |||||
", updateBy=" + updateBy + | |||||
", createOn=" + createOn + | |||||
", updateOn=" + updateOn + | |||||
", isLast=" + isLast + | |||||
"}"; | |||||
"id=" + id + | |||||
", templateType=" + templateType + | |||||
", content=" + content + | |||||
", createBy=" + createBy + | |||||
", updateBy=" + updateBy + | |||||
", createOn=" + createOn + | |||||
", updateOn=" + updateOn + | |||||
", isLast=" + isLast + | |||||
"}"; | |||||
} | } | ||||
} | } |
@@ -0,0 +1,46 @@ | |||||
package com.ningdatech.pmapi.expert.model.enumeration; | |||||
import lombok.Getter; | |||||
import java.util.Arrays; | |||||
/** | |||||
* <p> | |||||
* ReviewTemplateTypeEnum | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 09:48 2023/2/15 | |||||
*/ | |||||
@Getter | |||||
public enum ReviewTemplateTypeEnum { | |||||
/** | |||||
* 评审模版类型 | |||||
*/ | |||||
PRELIMINARY_SCHEME_REVIEW("初步方案评审", 1), | |||||
CONSTRUCTION_SCHEME_REVIEW("建设方案评审", 2), | |||||
ACCEPTANCE_SCHEME_REVIEW("验收方案评审", 3); | |||||
private final String value; | |||||
private final Integer code; | |||||
ReviewTemplateTypeEnum(String value, Integer code) { | |||||
this.value = value; | |||||
this.code = code; | |||||
} | |||||
public boolean eq(Integer code) { | |||||
return this.getCode().equals(code); | |||||
} | |||||
public static ReviewTemplateTypeEnum getByCode(Integer code) { | |||||
return Arrays.stream(values()) | |||||
.filter(w -> w.getCode().equals(code)) | |||||
.findFirst() | |||||
.orElseThrow(() -> new IllegalArgumentException("评审模版类型编码无效")); | |||||
} | |||||
} |
@@ -0,0 +1,32 @@ | |||||
package com.ningdatech.pmapi.expert.model.req; | |||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import javax.validation.Valid; | |||||
import javax.validation.constraints.NotEmpty; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* ReviewTemplateReq | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 10:11 2023/2/15 | |||||
*/ | |||||
@Data | |||||
public class ReviewTemplateReq { | |||||
@ApiModelProperty("模版类型") | |||||
@NotNull(message = "模版类型不能为空") | |||||
private Integer templateType; | |||||
@Valid | |||||
@NotEmpty(message = "模版不能为空") | |||||
@ApiModelProperty("模版数据") | |||||
private List<ReviewTemplateSettingsDTO> templates; | |||||
} |
@@ -0,0 +1,34 @@ | |||||
package com.ningdatech.pmapi.expert.model.vo; | |||||
import com.ningdatech.pmapi.expert.model.dto.ReviewTemplateSettingsDTO; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Builder; | |||||
import lombok.Data; | |||||
import javax.validation.Valid; | |||||
import javax.validation.constraints.NotEmpty; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* ReviewTemplateReq | |||||
* </p> | |||||
* | |||||
* @author WendyYang | |||||
* @since 10:11 2023/2/15 | |||||
*/ | |||||
@Data | |||||
@Builder | |||||
public class ReviewTemplateVO { | |||||
@ApiModelProperty("模版ID") | |||||
private Long templateId; | |||||
@ApiModelProperty("模版类型") | |||||
private Integer templateType; | |||||
@ApiModelProperty("模版数据") | |||||
private List<ReviewTemplateSettingsDTO> templates; | |||||
} |
@@ -1,15 +1,15 @@ | |||||
package com.ningdatech.pmapi.organization.model.entity; | package com.ningdatech.pmapi.organization.model.entity; | ||||
import com.baomidou.mybatisplus.annotation.TableName; | import com.baomidou.mybatisplus.annotation.TableName; | ||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | import lombok.Data; | ||||
import java.io.Serializable; | |||||
import java.time.LocalDateTime; | |||||
/** | /** | ||||
* <p> | * <p> | ||||
* | |||||
* | |||||
* </p> | * </p> | ||||
* | * | ||||
* @author Lierbao | * @author Lierbao | ||||
@@ -68,4 +68,6 @@ public class DingEmployeeInfo implements Serializable { | |||||
private String empStatus; | private String empStatus; | ||||
private Long accountId; | |||||
} | } |
@@ -0,0 +1,38 @@ | |||||
package com.ningdatech.pmapi.sys.controller; | |||||
import com.ningdatech.pmapi.sys.manage.RegionManage; | |||||
import com.ningdatech.pmapi.sys.model.vo.RegionTreeVO; | |||||
import io.swagger.annotations.Api; | |||||
import io.swagger.annotations.ApiOperation; | |||||
import lombok.RequiredArgsConstructor; | |||||
import org.springframework.validation.annotation.Validated; | |||||
import org.springframework.web.bind.annotation.GetMapping; | |||||
import org.springframework.web.bind.annotation.RequestMapping; | |||||
import org.springframework.web.bind.annotation.RestController; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 前端控制器 | |||||
* </p> | |||||
* | |||||
* @author LiuXinXin | |||||
* @since 2022-10-08 | |||||
*/ | |||||
@Validated | |||||
@RestController | |||||
@RequiredArgsConstructor | |||||
@RequestMapping("/api/v1/region") | |||||
@Api(tags = "系统管理-地域管理") | |||||
public class RegionController { | |||||
private final RegionManage regionManage; | |||||
@GetMapping("/tree") | |||||
@ApiOperation("获取区域编码的树状结构") | |||||
public List<RegionTreeVO> getRegionTree() { | |||||
return regionManage.getRegionTree(); | |||||
} | |||||
} |
@@ -24,7 +24,7 @@ public class RegionManage { | |||||
private final IRegionService regionService; | private final IRegionService regionService; | ||||
private final static Long ROOT_PARENT_ID = 1L; | |||||
private final static Long ROOT_PARENT_ID = 0L; | |||||
public List<RegionTreeVO> getRegionTree() { | public List<RegionTreeVO> getRegionTree() { | ||||
List<RegionDTO> regions = regionService.queryAll(); | List<RegionDTO> regions = regionService.queryAll(); | ||||
@@ -46,7 +46,7 @@ public class Menu extends MenuTreeEntity<Menu, Long> { | |||||
@ApiModelProperty(value = "是否隐藏") | @ApiModelProperty(value = "是否隐藏") | ||||
@TableField(value = "hidden") | @TableField(value = "hidden") | ||||
private Boolean hidden; | |||||
private Integer hidden; | |||||
@ApiModelProperty(value = "activeMenu") | @ApiModelProperty(value = "activeMenu") | ||||
@TableField(value = "active_menu") | @TableField(value = "active_menu") | ||||
@@ -76,4 +76,7 @@ public class UserInfo implements Serializable { | |||||
@ApiModelProperty("身份证号") | @ApiModelProperty("身份证号") | ||||
private String idCard; | private String idCard; | ||||
@ApiModelProperty("浙政钉accountId") | |||||
private Long accountId; | |||||
} | } |
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil; | |||||
import cn.hutool.core.io.FileUtil; | import cn.hutool.core.io.FileUtil; | ||||
import cn.hutool.db.Db; | import cn.hutool.db.Db; | ||||
import cn.hutool.db.Entity; | import cn.hutool.db.Entity; | ||||
import cn.hutool.json.JSONArray; | |||||
import cn.hutool.json.JSONObject; | import cn.hutool.json.JSONObject; | ||||
import cn.hutool.json.JSONUtil; | import cn.hutool.json.JSONUtil; | ||||
import com.ningdatech.pmapi.AppTests; | import com.ningdatech.pmapi.AppTests; | ||||
@@ -46,11 +45,13 @@ class IMenuServiceTest extends AppTests { | |||||
@Test | @Test | ||||
public void initMenu() { | public void initMenu() { | ||||
/*String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); | |||||
menuService.remove(null); | |||||
roleMenuService.remove(null); | |||||
String str = FileUtil.readString("/Users/wendy/Desktop/long_text_2023-02-13-15-28-42.txt", "UTF-8"); | |||||
List<JSONObject> obj = JSONUtil.toList(str, JSONObject.class); | List<JSONObject> obj = JSONUtil.toList(str, JSONObject.class); | ||||
save(obj, 0);*/ | |||||
save(obj, 0); | |||||
menuService.list().forEach(w -> { | menuService.list().forEach(w -> { | ||||
roleMenuService.save(new RoleMenu(){{ | |||||
roleMenuService.save(new RoleMenu() {{ | |||||
setRoleId(1L); | setRoleId(1L); | ||||
setMenuId(w.getId()); | setMenuId(w.getId()); | ||||
}}); | }}); | ||||
@@ -67,7 +68,7 @@ class IMenuServiceTest extends AppTests { | |||||
menu.setName(w.getStr("path").replace("/", "")); | menu.setName(w.getStr("path").replace("/", "")); | ||||
menu.setTopMenu(w.getStr("topMenu")); | menu.setTopMenu(w.getStr("topMenu")); | ||||
menu.setTitle(w.getStr("title")); | menu.setTitle(w.getStr("title")); | ||||
menu.setHidden(w.getBool("hidden")); | |||||
menu.setHidden(w.getInt("hidden")); | |||||
menu.setPid(parentId); | menu.setPid(parentId); | ||||
menu.setRedirect(w.getStr("redirect")); | menu.setRedirect(w.getStr("redirect")); | ||||
menu.setSort(w.getInt("sort")); | menu.setSort(w.getInt("sort")); | ||||