@@ -150,17 +150,6 @@ | |||
</dependency> | |||
<dependency> | |||
<groupId>com.ningdatech</groupId> | |||
<artifactId>nd-zwdd-starter</artifactId> | |||
<exclusions> | |||
<exclusion> | |||
<groupId>org.slf4j</groupId> | |||
<artifactId>slf4j-log4j12</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
<version>1.0.0</version> | |||
</dependency> | |||
<dependency> | |||
<groupId>com.dm</groupId> | |||
<artifactId>Dm8JdbcDriver</artifactId> | |||
<version>1.8</version> | |||
@@ -202,14 +191,6 @@ | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
<!--浙政钉--> | |||
<dependency> | |||
<groupId>com.alibaba.xxpt</groupId> | |||
<artifactId>zwdd</artifactId> | |||
<version>1.2.0</version> | |||
<scope>system</scope> | |||
<systemPath>${basedir}/src/lib/zwdd-sdk-java-1.2.0.jar</systemPath> | |||
</dependency> | |||
<dependency> | |||
<groupId>joda-time</groupId> | |||
<artifactId>joda-time</artifactId> | |||
@@ -30,7 +30,7 @@ public class SelfTestAction { | |||
return purchase; | |||
} | |||
@OnTransition(source = "WITHOUT_SELF_TEST_INFO", target = "TEST_VALID_INFO_AUDIT") | |||
@OnTransition(source = "WITHOUT_SELF_TEST_INFO", target = "SELF_TEST_INFO_AUDIT") | |||
public void SUBMIT_SELF_TEST_INFO(Message<SelfTestStateChangeEvent> message) { | |||
Purchase purchase = getPurchaseInfo(message); | |||
purchase.setSelfTestStatus(TenderSelfTestStatusEnum.SELF_TEST_INFO_AUDIT.getCode()); | |||
@@ -3,7 +3,11 @@ package com.hz.pm.api.common.statemachine.util; | |||
import com.hz.pm.api.common.statemachine.builder.AdaptStateMachineBuilder; | |||
import com.hz.pm.api.common.statemachine.event.AdaptStateChangeEvent; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.TenderAdaptStatusEnum; | |||
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.wflow.exception.BusinessException; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -14,6 +18,7 @@ import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
/** | |||
@@ -34,6 +39,8 @@ public class AdaptStateMachineUtil { | |||
//================================================================================================================== | |||
private final AdaptStateMachineBuilder adaptStateMachineBuilder; | |||
private final IPurchaseStatusChangeService purchaseStatusChangeService; | |||
//通过审核 | |||
public void pass(Purchase purchase) { | |||
@@ -68,6 +75,13 @@ public class AdaptStateMachineUtil { | |||
public void execute(Purchase purchase, AdaptStateChangeEvent event) throws Exception { | |||
log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); | |||
// 获取TO状态机 | |||
PurchaseStatusChange change = new PurchaseStatusChange(); | |||
change.setBeforeStatus(purchase.getAdaptStatus()); | |||
change.setEvent(event.name()); | |||
change.setBidId(purchase.getId()); | |||
change.setProjectId(purchase.getProjectId()); | |||
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId())); | |||
change.setCreateOn(LocalDateTime.now()); | |||
StateMachine<TenderAdaptStatusEnum, AdaptStateChangeEvent> stateMachine = adaptStateMachineBuilder.build(); | |||
Message<AdaptStateChangeEvent> message = MessageBuilder.withPayload(event) | |||
.setHeader(PURCHASE, purchase) | |||
@@ -76,6 +90,8 @@ public class AdaptStateMachineUtil { | |||
StateMachinePersister<TenderAdaptStatusEnum, AdaptStateChangeEvent, Purchase> stateMachinePersister = adaptStateMachineBuilder.stateMachinePersister(); | |||
stateMachinePersister.restore(stateMachine, purchase); | |||
stateMachine.sendEvent(message); | |||
change.setAfterStatus(purchase.getAdaptStatus()); | |||
purchaseStatusChangeService.save(change); | |||
log.info("调用状态机后的标段状态为:{}", purchase.getAdaptStatus()); | |||
} | |||
@@ -3,7 +3,11 @@ package com.hz.pm.api.common.statemachine.util; | |||
import com.hz.pm.api.common.statemachine.builder.SelfTestStateMachineBuilder; | |||
import com.hz.pm.api.common.statemachine.event.SelfTestStateChangeEvent; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.TenderSelfTestStatusEnum; | |||
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.wflow.exception.BusinessException; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -14,6 +18,7 @@ import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
/** | |||
@@ -34,6 +39,7 @@ public class SelfTestStateMachineUtil { | |||
//================================================================================================================== | |||
private final SelfTestStateMachineBuilder selfTestStateMachineBuilder; | |||
private final IPurchaseStatusChangeService purchaseStatusChangeService; | |||
//通过审核 | |||
public void pass(Purchase purchase) { | |||
@@ -68,6 +74,13 @@ public class SelfTestStateMachineUtil { | |||
public void execute(Purchase purchase, SelfTestStateChangeEvent event) throws Exception { | |||
log.info("调用状态机前的标段状态为:{}", purchase.getSelfTestStatus()); | |||
// 获取TO状态机 | |||
PurchaseStatusChange change = new PurchaseStatusChange(); | |||
change.setBeforeStatus(purchase.getSelfTestStatus()); | |||
change.setEvent(event.name()); | |||
change.setBidId(purchase.getId()); | |||
change.setProjectId(purchase.getProjectId()); | |||
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId())); | |||
change.setCreateOn(LocalDateTime.now()); | |||
StateMachine<TenderSelfTestStatusEnum, SelfTestStateChangeEvent> stateMachine = selfTestStateMachineBuilder.build(); | |||
Message<SelfTestStateChangeEvent> message = MessageBuilder.withPayload(event) | |||
.setHeader(PURCHASE, purchase) | |||
@@ -76,6 +89,8 @@ public class SelfTestStateMachineUtil { | |||
StateMachinePersister<TenderSelfTestStatusEnum, SelfTestStateChangeEvent, Purchase> stateMachinePersister = selfTestStateMachineBuilder.stateMachinePersister(); | |||
stateMachinePersister.restore(stateMachine, purchase); | |||
stateMachine.sendEvent(message); | |||
change.setAfterStatus(purchase.getSelfTestStatus()); | |||
purchaseStatusChangeService.save(change); | |||
log.info("调用状态机后的标段状态为:{}", purchase.getSelfTestStatus()); | |||
} | |||
@@ -3,7 +3,10 @@ package com.hz.pm.api.common.statemachine.util; | |||
import com.hz.pm.api.common.statemachine.builder.TenderStateMachineBuilder; | |||
import com.hz.pm.api.common.statemachine.event.TenderStatusChangeEvent; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.TenderStatusEnum; | |||
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.wflow.exception.BusinessException; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -14,6 +17,7 @@ import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
/** | |||
@@ -34,6 +38,7 @@ public class TenderStateMachineUtil { | |||
//================================================================================================================== | |||
private final TenderStateMachineBuilder tenderStateMachineBuilder; | |||
private final IPurchaseStatusChangeService purchaseStatusChangeService; | |||
//通过审核 | |||
public void pass(Purchase purchase) { | |||
@@ -68,6 +73,13 @@ public class TenderStateMachineUtil { | |||
public void execute(Purchase purchase, TenderStatusChangeEvent event) throws Exception { | |||
log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); | |||
// 获取TO状态机 | |||
PurchaseStatusChange change = new PurchaseStatusChange(); | |||
change.setBeforeStatus(purchase.getAdaptStatus()); | |||
change.setEvent(event.name()); | |||
change.setBidId(purchase.getId()); | |||
change.setProjectId(purchase.getProjectId()); | |||
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId())); | |||
change.setCreateOn(LocalDateTime.now()); | |||
StateMachine<TenderStatusEnum, TenderStatusChangeEvent> stateMachine = tenderStateMachineBuilder.build(); | |||
Message<TenderStatusChangeEvent> message = MessageBuilder.withPayload(event) | |||
.setHeader(PURCHASE, purchase) | |||
@@ -76,6 +88,8 @@ public class TenderStateMachineUtil { | |||
StateMachinePersister<TenderStatusEnum, TenderStatusChangeEvent, Purchase> stateMachinePersister = tenderStateMachineBuilder.stateMachinePersister(); | |||
stateMachinePersister.restore(stateMachine, purchase); | |||
stateMachine.sendEvent(message); | |||
change.setAfterStatus(purchase.getAdaptStatus()); | |||
purchaseStatusChangeService.save(change); | |||
log.info("调用状态机后的标段状态为:{}", purchase.getStatus()); | |||
} | |||
@@ -3,7 +3,11 @@ package com.hz.pm.api.common.statemachine.util; | |||
import com.hz.pm.api.common.statemachine.builder.TestValidStateMachineBuilder; | |||
import com.hz.pm.api.common.statemachine.event.TestValidStateChangeEvent; | |||
import com.hz.pm.api.projectdeclared.model.entity.Purchase; | |||
import com.hz.pm.api.projectdeclared.utils.ProjectIdCodeCacheUtil; | |||
import com.hz.pm.api.projectlib.entity.PurchaseStatusChange; | |||
import com.hz.pm.api.projectlib.model.enumeration.InstTypeEnum; | |||
import com.hz.pm.api.projectlib.model.enumeration.TenderTestValidStatusEnum; | |||
import com.hz.pm.api.projectlib.service.IPurchaseStatusChangeService; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.wflow.exception.BusinessException; | |||
import lombok.RequiredArgsConstructor; | |||
@@ -14,6 +18,7 @@ import org.springframework.statemachine.StateMachine; | |||
import org.springframework.statemachine.persist.StateMachinePersister; | |||
import org.springframework.stereotype.Component; | |||
import java.time.LocalDateTime; | |||
import java.util.Objects; | |||
/** | |||
@@ -34,6 +39,7 @@ public class TestValidStateMachineUtil { | |||
//================================================================================================================== | |||
private final TestValidStateMachineBuilder testValidStateMachineBuilder; | |||
private final IPurchaseStatusChangeService purchaseStatusChangeService; | |||
//通过审核 | |||
public void pass(Purchase purchase) { | |||
@@ -68,6 +74,13 @@ public class TestValidStateMachineUtil { | |||
public void execute(Purchase purchase, TestValidStateChangeEvent event) throws Exception { | |||
log.info("调用状态机前的标段状态为:{}", purchase.getStatus()); | |||
// 获取TO状态机 | |||
PurchaseStatusChange change = new PurchaseStatusChange(); | |||
change.setBeforeStatus(purchase.getTestValidStatus()); | |||
change.setEvent(event.name()); | |||
change.setBidId(purchase.getId()); | |||
change.setProjectId(purchase.getProjectId()); | |||
change.setProjectCode(ProjectIdCodeCacheUtil.get(purchase.getProjectId())); | |||
change.setCreateOn(LocalDateTime.now()); | |||
StateMachine<TenderTestValidStatusEnum, TestValidStateChangeEvent> stateMachine = testValidStateMachineBuilder.build(); | |||
Message<TestValidStateChangeEvent> message = MessageBuilder.withPayload(event) | |||
.setHeader(PURCHASE, purchase) | |||
@@ -76,6 +89,8 @@ public class TestValidStateMachineUtil { | |||
StateMachinePersister<TenderTestValidStatusEnum, TestValidStateChangeEvent, Purchase> stateMachinePersister = testValidStateMachineBuilder.stateMachinePersister(); | |||
stateMachinePersister.restore(stateMachine, purchase); | |||
stateMachine.sendEvent(message); | |||
change.setAfterStatus(purchase.getTestValidStatus()); | |||
purchaseStatusChangeService.save(change); | |||
log.info("调用状态机后的标段状态为:{}", purchase.getStatus()); | |||
} | |||
@@ -1,33 +0,0 @@ | |||
package com.hz.pm.api.ding.controller; | |||
import com.hz.pm.api.ding.task.GovBusinessStripsTask; | |||
import com.hz.pm.api.irs.model.dto.ForwardDTO; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
/** | |||
* <p> | |||
* PullDingInfoController | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 2023/6/2 | |||
**/ | |||
@RestController | |||
@RequestMapping("/api/v1/zwdd/pull") | |||
@RequiredArgsConstructor | |||
@Slf4j | |||
public class DingInfoPullController { | |||
private final GovBusinessStripsTask businessStripsTask; | |||
@GetMapping("/businessStrips") | |||
public void businessStripsBatchGet() { | |||
businessStripsTask.batchGetGovBusinessStripsTask(); | |||
} | |||
} |
@@ -1,29 +0,0 @@ | |||
package com.hz.pm.api.ding.model; | |||
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @author liuxinxin | |||
* @date 2022/8/24 上午11:06 | |||
* 钉钉组织结构树状结构 | |||
*/ | |||
@Data | |||
public class DingOrgInfoTreeDTO { | |||
/** | |||
* 钉钉code码 | |||
*/ | |||
private String code; | |||
/** | |||
* 组织信息 | |||
*/ | |||
private DingOrgInfoDTO dingOrgInfoDTO; | |||
/** | |||
* 子节点code | |||
*/ | |||
private List<DingOrgInfoTreeDTO> childCodes; | |||
} |
@@ -1,100 +0,0 @@ | |||
package com.hz.pm.api.ding.task; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.hz.pm.api.organization.entity.GovBusinessStrip; | |||
import com.hz.pm.api.organization.service.IGovBusinessStripService; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.ningdatech.zwdd.model.Page; | |||
import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; | |||
import com.ningdatech.zwdd.model.query.PageSubGovBusinessStripsQuery; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/3/8 下午2:55 | |||
*/ | |||
@Component | |||
@Slf4j | |||
@RequiredArgsConstructor | |||
public class GovBusinessStripsTask { | |||
private static final Integer PAGE_SIZE = 20; | |||
private static final Integer GROUP_SIZE = 100; | |||
private final ZwddClient zwddClient; | |||
private final IGovBusinessStripService iGovBusinessStripService; | |||
@Transactional(rollbackFor = Exception.class) | |||
public void batchGetGovBusinessStripsTask() { | |||
PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); | |||
pageSubGovBusinessStripsQuery.setPageNo(1); | |||
pageSubGovBusinessStripsQuery.setPageSize(100); | |||
GenericResult<Page<SubGovBusinessStripsDTO>> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); | |||
log.info("pageGenericResult :{}", JSON.toJSONString(pageGenericResult)); | |||
if (!pageGenericResult.isSuccess()) { | |||
return; | |||
} | |||
Page<SubGovBusinessStripsDTO> data = pageGenericResult.getData(); | |||
List<SubGovBusinessStripsDTO> govBusinessStripsDTOList = data.getData(); | |||
List<GovBusinessStrip> govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { | |||
GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); | |||
govBusinessStrip.setBusinessStripCode(r.getCode()); | |||
govBusinessStrip.setBusinessStripName(r.getName()); | |||
return govBusinessStrip; | |||
}).collect(Collectors.toList()); | |||
saveBatch(govBusinessStripList); | |||
for (SubGovBusinessStripsDTO subGovBusinessStripsDTO : govBusinessStripsDTOList) { | |||
saveSub(subGovBusinessStripsDTO); | |||
} | |||
} | |||
public void saveSub(SubGovBusinessStripsDTO parentGovBusinessStripsDTO) { | |||
String parentCode = parentGovBusinessStripsDTO.getCode(); | |||
String parentName = parentGovBusinessStripsDTO.getName(); | |||
PageSubGovBusinessStripsQuery pageSubGovBusinessStripsQuery = new PageSubGovBusinessStripsQuery(); | |||
pageSubGovBusinessStripsQuery.setPageNo(1); | |||
pageSubGovBusinessStripsQuery.setPageSize(100); | |||
pageSubGovBusinessStripsQuery.setBusinessStripCode(parentCode); | |||
GenericResult<Page<SubGovBusinessStripsDTO>> pageGenericResult = zwddClient.pageSubGovBusinessStrips(pageSubGovBusinessStripsQuery); | |||
Page<SubGovBusinessStripsDTO> data = pageGenericResult.getData(); | |||
List<SubGovBusinessStripsDTO> govBusinessStripsDTOList = data.getData(); | |||
if (CollectionUtil.isNotEmpty(govBusinessStripsDTOList)) { | |||
List<GovBusinessStrip> govBusinessStripList = govBusinessStripsDTOList.stream().map(r -> { | |||
GovBusinessStrip govBusinessStrip = new GovBusinessStrip(); | |||
govBusinessStrip.setBusinessStripCode(r.getCode()); | |||
govBusinessStrip.setBusinessStripName(r.getName()); | |||
govBusinessStrip.setParentCode(parentCode); | |||
govBusinessStrip.setParentName(parentName); | |||
return govBusinessStrip; | |||
}).collect(Collectors.toList()); | |||
saveBatch(govBusinessStripList); | |||
} | |||
} | |||
public void saveBatch(List<GovBusinessStrip> govBusinessStripList) { | |||
if (CollectionUtil.isNotEmpty(govBusinessStripList)) { | |||
iGovBusinessStripService.saveBatch(govBusinessStripList); | |||
} | |||
} | |||
} |
@@ -37,13 +37,6 @@ public class ExpertController { | |||
private final ExpertManage expertManage; | |||
private final ExpertAdminManage expertAdminManage; | |||
@PostMapping("/registration") | |||
@ApiOperation("社会专家报名") | |||
@WebLog("社会专家报名") | |||
public void expertRegistration(@Valid @RequestBody ExpertRegistrationRequest request) { | |||
expertManage.expertRegistration(request); | |||
} | |||
@GetMapping("/portrait/{expertId}/{year}") | |||
public ExpertPortraitVO expertPortrait(@PathVariable Long expertId, @PathVariable Integer year) { | |||
return expertManage.expertPortrait(expertId, year); | |||
@@ -74,11 +67,4 @@ public class ExpertController { | |||
return expertAdminManage.adminModifyExpertBasicInfo(request); | |||
} | |||
@PostMapping("/get-zzd-info") | |||
@ApiOperation("获取浙政钉用户信息") | |||
@WebLog("获取浙政钉用户信息") | |||
public ZzdInfoByMobileVO getZzdInfo(@Valid @RequestBody GetZzdInfoRequest request) { | |||
return expertAdminManage.getZzdInfo(request); | |||
} | |||
} |
@@ -3,11 +3,7 @@ package com.hz.pm.api.expert.manage; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.basic.model.PageVo; | |||
import com.hz.pm.api.common.enumeration.BoolDisplayEnum; | |||
import com.hz.pm.api.common.helper.RegionLimitHelper; | |||
import com.hz.pm.api.common.model.CommonPage; | |||
import com.hz.pm.api.common.util.StrUtils; | |||
import com.hz.pm.api.expert.assembler.ExpertAdminExpertManageAssembler; | |||
@@ -18,7 +14,6 @@ import com.hz.pm.api.expert.constant.ExpertApplyTypeEnum; | |||
import com.hz.pm.api.expert.constant.QueryExpertAccountStatusEnum; | |||
import com.hz.pm.api.expert.entity.ExpertMetaApply; | |||
import com.hz.pm.api.expert.helper.ExpertInfoSensitiveFieldModifyCheckHelper; | |||
import com.hz.pm.api.expert.helper.PermissionCheckHelper; | |||
import com.hz.pm.api.expert.model.*; | |||
import com.hz.pm.api.expert.model.bo.ExpertInfoSensitiveFieldCheckBO; | |||
import com.hz.pm.api.expert.model.cmd.ExpertAdminExpertManageQueryCmd; | |||
@@ -26,27 +21,22 @@ import com.hz.pm.api.expert.model.cmd.ExpertInfoModifyCmd; | |||
import com.hz.pm.api.expert.model.dto.ExpertAdminExpertListDTO; | |||
import com.hz.pm.api.expert.model.query.ExpertDictionaryQuery; | |||
import com.hz.pm.api.expert.model.req.AdminExpertBasicInfoModifyRequest; | |||
import com.hz.pm.api.expert.model.req.GetZzdInfoRequest; | |||
import com.hz.pm.api.expert.model.req.MetaApplyResultRequest; | |||
import com.hz.pm.api.expert.model.vo.ExpertLibraryListItemVO; | |||
import com.hz.pm.api.expert.model.vo.ExpertBasicInfoModifyResultVO; | |||
import com.hz.pm.api.expert.model.vo.ZzdInfoByMobileVO; | |||
import com.hz.pm.api.expert.model.vo.ExpertLibraryListItemVO; | |||
import com.hz.pm.api.expert.service.ExpertAdminManageService; | |||
import com.hz.pm.api.expert.service.ExpertInfoService; | |||
import com.hz.pm.api.expert.service.IExpertMetaApplyService; | |||
import com.hz.pm.api.meta.constant.ExpertDictTypeEnum; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; | |||
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; | |||
import com.ningdatech.zwdd.model.dto.EmployeeInfoDTO; | |||
import com.ningdatech.zwdd.model.dto.EmployeePositionsDTO; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.PageVo; | |||
import lombok.RequiredArgsConstructor; | |||
import org.apache.commons.collections4.CollectionUtils; | |||
import org.apache.commons.lang3.StringUtils; | |||
import org.springframework.stereotype.Component; | |||
import java.util.*; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Objects; | |||
/** | |||
* @author liuxinxin | |||
@@ -57,15 +47,12 @@ import java.util.*; | |||
@RequiredArgsConstructor | |||
public class ExpertAdminManage { | |||
private final PermissionCheckHelper permissionCheckHelper; | |||
private final RegionLimitHelper regionLimitHelper; | |||
private final IExpertMetaApplyService iExpertMetaApplyService; | |||
private final ExpertInfoSensitiveFieldModifyCheckHelper expertInfoSensitiveFieldModifyCheckHelper; | |||
private final ExpertInfoService expertInfoService; | |||
private final ExpertMetaApplyManage expertMetaApplyManage; | |||
private final ExpertAdminManageService expertAdminManageService; | |||
private final ExpertAdminExpertManageAssembler expertAdminExpertManageAssembler; | |||
private final ZwddClient zwddClient; | |||
/** | |||
* 专家管理员使用 专家库列表查询 | |||
@@ -197,36 +184,4 @@ public class ExpertAdminManage { | |||
return new ExpertBasicInfoModifyResultVO(false); | |||
} | |||
public ZzdInfoByMobileVO getZzdInfo(GetZzdInfoRequest request) { | |||
ZzdInfoByMobileVO zzdInfoByMobileVO = new ZzdInfoByMobileVO(); | |||
String phoneNo = request.getPhoneNo(); | |||
zzdInfoByMobileVO.setPhoneNo(phoneNo); | |||
GenericResult<DingInfoByMobileDTO> dingInfoByMobile = zwddClient.getDingInfoByMobile(phoneNo); | |||
DingInfoByMobileDTO dingInfo = dingInfoByMobile.getData(); | |||
if (Objects.nonNull(dingInfo) && StringUtils.isNotBlank(dingInfo.getEmployeeCode())) { | |||
zzdInfoByMobileVO.setIsDingUser(true); | |||
String employeeCode = dingInfo.getEmployeeCode(); | |||
GenericResult<List<EmployeePositionsDTO>> listGenericResult = zwddClient.listEmployeePositionsByEmployeeCode(employeeCode); | |||
List<EmployeePositionsDTO> employeePositionsDTOS = listGenericResult.getData(); | |||
if (CollectionUtils.isNotEmpty(employeePositionsDTOS)) { | |||
EmployeePositionsDTO employeePositionsDTO = employeePositionsDTOS.get(0); | |||
String organizationCode = employeePositionsDTO.getOrganizationCode(); | |||
GenericResult<DingOrgInfoDTO> dingOrgInfoDTOGenericResult = zwddClient.getOrganizationByCode(organizationCode); | |||
DingOrgInfoDTO organizationByCode = dingOrgInfoDTOGenericResult.getData(); | |||
String organizationName = organizationByCode.getOrganizationName(); | |||
zzdInfoByMobileVO.setCompanyName(organizationName); | |||
} | |||
GenericResult<EmployeeInfoDTO> infoDTOGenericResult = zwddClient.getEmployeeByCode(employeeCode); | |||
EmployeeInfoDTO employeeInfoDTO = infoDTOGenericResult.getData(); | |||
if (Objects.nonNull(employeeInfoDTO)) { | |||
String employeeName = employeeInfoDTO.getEmployeeName(); | |||
zzdInfoByMobileVO.setName(employeeName); | |||
} | |||
} else { | |||
zzdInfoByMobileVO.setIsDingUser(false); | |||
} | |||
return zzdInfoByMobileVO; | |||
} | |||
} |
@@ -2,25 +2,13 @@ package com.hz.pm.api.expert.manage; | |||
import cn.hutool.core.bean.BeanUtil; | |||
import cn.hutool.core.collection.CollUtil; | |||
import cn.hutool.core.util.StrUtil; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.common.model.constant.BizConst; | |||
import com.hz.pm.api.common.model.entity.KeyValDTO; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.expert.assembler.ExpertInfoCmdAssembler; | |||
import com.hz.pm.api.expert.entity.ExpertUserFullInfo; | |||
import com.hz.pm.api.expert.helper.ExpertManageHelper; | |||
import com.hz.pm.api.expert.model.ExpertBasicInfo; | |||
import com.hz.pm.api.expert.model.ExpertEduInfo; | |||
import com.hz.pm.api.expert.model.ExpertJobInfo; | |||
import com.hz.pm.api.expert.model.ExpertProfessionalInfo; | |||
import com.hz.pm.api.expert.model.cmd.ExpertFullInfoSaveCmd; | |||
import com.hz.pm.api.expert.model.dto.DictionaryVO; | |||
import com.hz.pm.api.expert.model.req.ExpertRegistrationRequest; | |||
import com.hz.pm.api.expert.model.req.ExpertUserBasicInfoSubmitRequest; | |||
import com.hz.pm.api.expert.model.vo.ExpertDetailVO; | |||
import com.hz.pm.api.expert.model.vo.ExpertPortraitVO; | |||
import com.hz.pm.api.expert.service.ExpertInfoService; | |||
import com.hz.pm.api.expert.service.IExpertUserFullInfoService; | |||
import com.hz.pm.api.external.MhExpertQrCodeGenClient; | |||
import com.hz.pm.api.external.MhFileClient; | |||
@@ -38,27 +26,12 @@ import com.hz.pm.api.meta.helper.DictionaryCache; | |||
import com.hz.pm.api.meta.model.dto.DictionaryDTO; | |||
import com.hz.pm.api.meta.model.entity.ExpertDictionary; | |||
import com.hz.pm.api.meta.service.IExpertDictionaryService; | |||
import com.hz.pm.api.sms.constant.VerificationCodeType; | |||
import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; | |||
import com.hz.pm.api.sys.model.entity.Role; | |||
import com.hz.pm.api.sys.model.entity.UserRole; | |||
import com.hz.pm.api.sys.service.IRoleService; | |||
import com.hz.pm.api.sys.service.IUserRoleService; | |||
import com.hz.pm.api.user.model.entity.UserInfo; | |||
import com.hz.pm.api.user.model.enumeration.RoleEnum; | |||
import com.hz.pm.api.user.model.enumeration.UserAvailableEnum; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import com.hz.pm.api.user.util.LoginUserUtil; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.basic.util.CollUtils; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.ningdatech.zwdd.model.dto.DingInfoByMobileDTO; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.stereotype.Component; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.time.LocalDate; | |||
import java.time.LocalDateTime; | |||
@@ -79,12 +52,7 @@ import java.util.stream.Collectors; | |||
@RequiredArgsConstructor | |||
public class ExpertManage { | |||
private final ExpertManageHelper expertManageHelper; | |||
private final IExpertUserFullInfoService expertUserFullInfoService; | |||
private final ExpertInfoService expertInfoService; | |||
private final IUserInfoService userInfoService; | |||
private final VerifyCodeCheckHelper verifyCodeCheckHelper; | |||
private final ZwddClient zwddClient; | |||
private final IMeetingExpertService meetingExpertService; | |||
private final IMeetingExpertJudgeService expertJudgeService; | |||
private final IExpertDictionaryService expertDictionaryService; | |||
@@ -190,89 +158,6 @@ public class ExpertManage { | |||
} | |||
public Long generateOrGetUserId(ExpertBasicInfo basicInfo, Long operatorId) { | |||
String phoneNo = basicInfo.getPhoneNo(); | |||
UserInfo userInfo = userInfoService.getUserInfoByPhoneNo(phoneNo); | |||
if (Objects.isNull(userInfo)) { | |||
GenericResult<DingInfoByMobileDTO> dingInfoByMobile = zwddClient.getDingInfoByMobile(basicInfo.getPhoneNo()); | |||
if (dingInfoByMobile.isSuccess()) { | |||
DingInfoByMobileDTO data = dingInfoByMobile.getData(); | |||
String accountId = data.getAccountId(); | |||
userInfo = userInfoService.getUserInfoByAccountId(Long.parseLong(accountId)); | |||
} | |||
if (userInfo == null) { | |||
userInfo = UserInfo.builder() | |||
.username(basicInfo.getName()) | |||
.realName(basicInfo.getName()) | |||
.available(UserAvailableEnum.DISABLE.name()) | |||
.mobile(phoneNo) | |||
.createBy(operatorId) | |||
.updateBy(operatorId) | |||
.createOn(LocalDateTime.now()) | |||
.updateOn(LocalDateTime.now()) | |||
.build(); | |||
userInfoService.save(userInfo); | |||
} else if (!StrUtil.equals(userInfo.getRealName(), basicInfo.getName())) { | |||
log.warn("相似账户为:{} ==> {}", basicInfo.getPhoneNo(), userInfo); | |||
throw BizException.wrap("已存在同手机号,但不同名的账号"); | |||
} else if (StrUtil.isBlank(userInfo.getMobile())) { | |||
userInfo.setMobile(basicInfo.getPhoneNo()); | |||
userInfoService.updateById(userInfo); | |||
} | |||
} | |||
ExpertUserFullInfo one = expertUserFullInfoService.getOne(Wrappers.lambdaQuery(ExpertUserFullInfo.class) | |||
.eq(ExpertUserFullInfo::getPhoneNo, phoneNo)); | |||
if (Objects.nonNull(one) && !one.getUserId().equals(userInfo.getId())) { | |||
throw new BizException("该手机号已被专家注册,请确认后再填写"); | |||
} | |||
return userInfo.getId(); | |||
} | |||
/** | |||
* 社会专家报名 需要校验手机号 | |||
* | |||
* @param request \ | |||
*/ | |||
@Transactional(rollbackFor = Exception.class) | |||
public void expertRegistration(ExpertRegistrationRequest request) { | |||
String verificationCode = request.getVerificationCode(); | |||
String phoneNo = request.getBasicInfo().getPhoneNo(); | |||
//校验 专家验证码 | |||
if (Boolean.TRUE.equals(expertRegistrationVerifyCodeCheck)) { | |||
verifyCodeCheckHelper.verification(VerificationCodeType.EXPERT_REGISTER, phoneNo, verificationCode); | |||
} | |||
assemblerAndGenerateExpert(request, null); | |||
} | |||
public Long assemblerAndGenerateExpert(ExpertUserBasicInfoSubmitRequest req, Long operatorId) { | |||
if (Objects.isNull(operatorId)) { | |||
operatorId = -1L; | |||
} | |||
ExpertBasicInfo basicInfo = req.getBasicInfo(); | |||
Long userId = generateOrGetUserId(basicInfo, operatorId); | |||
// 校验区域编码合法性 校验履职意向编码合法性 | |||
ExpertEduInfo eduInfo = req.getEduInfo(); | |||
ExpertJobInfo jobInfo = req.getJobInfo(); | |||
ExpertProfessionalInfo professionalInfo = req.getProfessionalInfo(); | |||
// 校验标签字段 | |||
expertManageHelper.tagFieldCheck(professionalInfo, basicInfo); | |||
// 校验字典字段 | |||
expertManageHelper.dictionaryFieldCheck(basicInfo, eduInfo, jobInfo); | |||
// 判断专家提交状态,判断是否可以进行此操作 | |||
ExpertUserFullInfo expertUserFullInfo = expertUserFullInfoService.getByUserId(userId); | |||
boolean submitBasicInfoStatusEnable = Objects.isNull(expertUserFullInfo); | |||
if (submitBasicInfoStatusEnable) { | |||
// 新建 保存 | |||
ExpertFullInfoSaveCmd expertFullInfoSaveCmd = ExpertInfoCmdAssembler | |||
.buildExpertFullInfoSaveCmd(userId, basicInfo, eduInfo, jobInfo, professionalInfo); | |||
expertInfoService.saveExpertInfo(expertFullInfoSaveCmd); | |||
} | |||
return userId; | |||
} | |||
public ExpertPortraitVO expertPortrait(Long expertId, Integer year) { | |||
ExpertPortraitVO portrait = ExpertPortraitVO.init(); | |||
LocalDate firstDate = LocalDate.of(year, 1, 1); | |||
@@ -1,16 +1,11 @@ | |||
package com.hz.pm.api.irs.controller; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; | |||
import com.ningdatech.zwdd.model.dto.SubGovBusinessStripsDTO; | |||
import io.swagger.annotations.Api; | |||
import io.swagger.annotations.ApiOperation; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.validation.annotation.Validated; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* @Classname OrganizationController | |||
@@ -26,17 +21,4 @@ import java.util.List; | |||
@RequiredArgsConstructor | |||
public class OrganizationController { | |||
private final ZwddClient zwddClient; | |||
@ApiOperation(value = "获取企业信息", notes = "获取企业信息") | |||
@GetMapping("/getOrganizationByCode/{code}") | |||
public DingOrgInfoDTO getOrganizationByCode(@PathVariable String code) { | |||
return zwddClient.getOrganizationByCode(code).getData(); | |||
} | |||
@ApiOperation(value = "获取条线列表", notes = "获取条线列表") | |||
@GetMapping("/getGovBusinessStripLine/{code}") | |||
public List<SubGovBusinessStripsDTO> getGovBusinessStripLine(@PathVariable String code) { | |||
return zwddClient.getGovBusinessStripLine(code).getData(); | |||
} | |||
} |
@@ -420,79 +420,6 @@ public class ConstructionManage { | |||
return PageVo.of(records, total); | |||
} | |||
public PageVo<ProjectLibListItemVO> xcfhxProjectList(ProjectListReq req) { | |||
UserInfoDetails user = LoginUserUtil.loginUserDetail(); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
LambdaQueryWrapper<Project> query = ProjectHelper.projectQuery(req); | |||
//建设中状态 | |||
query.eq(Project::getStatus, ProjectStatusEnum.ON_FIRST_INSPECTED.getCode()); | |||
query.eq(Project::getStage, ProjectStatusEnum.PROJECT_APPROVED.getCode()); | |||
query.eq(Project::getNewest, Boolean.TRUE); | |||
//只能看自己单位的 | |||
query.eq(Project::getBuildOrgCode, user.getMhUnitIdStr()); | |||
query.orderByAsc(Project::getDeliveryTime); | |||
Page<Project> page = projectService.page(req.page(), query); | |||
long total; | |||
if ((total = page.getTotal()) == 0) { | |||
return PageVo.empty(); | |||
} | |||
List<Long> projectIds = new ArrayList<>(); | |||
for (Project project : page.getRecords()) { | |||
projectIds.add(project.getId()); | |||
} | |||
List<Purchase> purchases = purchaseService.listByProjectIds(projectIds); | |||
Map<Long, List<Purchase>> purchaseMap = CollUtils.group(purchases, Purchase::getProjectId); | |||
Map<Long, Contract> contractMap = contractService.listByProjectIds(projectIds); | |||
Map<Long, List<ProjectAnnualPaymentPlan>> paymentPlansMap = projectPaymentPlanService.listByProjectIds(projectIds); | |||
List<ProjectLibListItemVO> records = CollUtils.convert(page.getRecords(), w -> { | |||
ProjectLibListItemVO item = new ProjectLibListItemVO(); | |||
item.setId(w.getId()); | |||
item.setProjectName(w.getProjectName()); | |||
item.setCreateOn(w.getCreateOn()); | |||
item.setDeclaredAmount(w.getDeclareAmount()); | |||
item.setStage(w.getStage()); | |||
item.setStatus(w.getStatus()); | |||
item.setProjectType(w.getProjectType()); | |||
item.setProjectYear(w.getProjectYear()); | |||
item.setBuildOrg(w.getBuildOrgName()); | |||
item.setBizDomain(w.getBizDomain()); | |||
item.setProcessStatus(w.getProcessStatus()); | |||
item.setInstCode(w.getInstCode()); | |||
item.setIsHigherSuperOrg(w.getIsHigherSuperOrg()); | |||
item.setApprovedAmount(w.getApprovalAmount()); | |||
item.setApprovalDate(w.getApprovalDate()); | |||
item.setDeliveryTime(w.getDeliveryTime()); | |||
item.setContractAmount(w.getContractAmount()); | |||
List<ProjectAnnualPaymentPlan> paymentPlans = paymentPlansMap.getOrDefault(w.getId(), Collections.emptyList()); | |||
BigDecimal totalAnnualAmount = paymentPlans.stream() | |||
.map(ProjectAnnualPaymentPlan::getAnnualPlanAmount) | |||
.reduce(BigDecimal::add).orElse(BigDecimal.ZERO); | |||
item.setAnnualPlanAmount(totalAnnualAmount); | |||
item.setTransactionTime(w.getTransactionTime()); | |||
item.setTransactionAmount(w.getTransactionAmount()); | |||
List<Purchase> currPurchases = purchaseMap.get(w.getId()); | |||
if (currPurchases != null) { | |||
List<TenderListInfoVO> tmpPurchases = CollUtils.convert(currPurchases, x -> { | |||
TenderListInfoVO tender = new TenderListInfoVO(); | |||
tender.setBidName(x.getBidName()); | |||
tender.setBidId(x.getId()); | |||
tender.setBidStatus(x.getStatus()); | |||
tender.setBidStatusName(TenderStatusEnum.getDescByStatus(x.getStatus())); | |||
Contract contract = contractMap.get(x.getId()); | |||
if (contract != null) { | |||
tender.setConstructionAmount(contract.getTotalAmount()); | |||
} | |||
return tender; | |||
}); | |||
item.setTenders(tmpPurchases); | |||
} | |||
return item; | |||
}); | |||
return PageVo.of(records, total); | |||
} | |||
public void exportPreList(HttpServletResponse response, ProjectListReq param) { | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
VUtils.isTrue(Objects.isNull(user)).throwMessage("获取登录用户失败!"); | |||
@@ -18,6 +18,7 @@ import com.hz.pm.api.common.enumeration.ProjectProcessStageEnum; | |||
import com.hz.pm.api.common.helper.UserInfoHelper; | |||
import com.hz.pm.api.common.statemachine.util.*; | |||
import com.hz.pm.api.common.util.BizUtils; | |||
import com.hz.pm.api.common.util.EnvironmentUtil; | |||
import com.hz.pm.api.common.util.ExcelDownUtil; | |||
import com.hz.pm.api.common.util.ExcelExportStyle; | |||
import com.hz.pm.api.datascope.model.DataScopeDTO; | |||
@@ -88,10 +89,12 @@ import java.util.concurrent.atomic.AtomicInteger; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @Classname PurchaseManage | |||
* @Description | |||
* @Date 2023/5/29 14:48 | |||
* @Author PoffyZhang | |||
* <p> | |||
* PurchaseManage | |||
* </p> | |||
* | |||
* @author WendyYang | |||
* @since 11:15 2024/4/2 | |||
*/ | |||
@Component | |||
@Slf4j | |||
@@ -117,6 +120,7 @@ public class PurchaseManage { | |||
private final AdaptStateMachineUtil adaptStateMachineUtil; | |||
private final IPurchaseInstService purchaseInstService; | |||
private final IProjectInstService projectInstService; | |||
private final EnvironmentUtil environmentUtil; | |||
private boolean buildPurchaseQueryPermission(LambdaQueryWrapper<Purchase> query, UserFullInfoDTO user) { | |||
boolean queryState = true; | |||
@@ -372,6 +376,9 @@ public class PurchaseManage { | |||
} | |||
private MhPurchaseNoticeDTO buildPurchaseNotice(PurchaseNoticeTenderDTO w, UserInfoDetails user) { | |||
if (environmentUtil.isDevEnv()) { | |||
return null; | |||
} | |||
Date now = new Date(); | |||
List<FileResultVO> bidFiles = JSONUtil.toList(w.getBidDoc(), FileResultVO.class); | |||
List<File> files = fileService.listByIds(CollUtils.fieldSet(bidFiles, FileResultVO::getId)); | |||
@@ -441,9 +448,9 @@ public class PurchaseManage { | |||
.or(q2 -> q2.exists(String.format("select 1 from nd_project_operation no" + | |||
" where no.bid_id = nd_purchase.id and no.%s is not null", actualTimeColumn)))); | |||
} else { | |||
query.and(q1 -> q1.ne(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) | |||
.or(q2 -> q2.exists(String.format("select 1 from nd_project_operation no" + | |||
" where no.bid_id = nd_purchase.id and no.%s is null", actualTimeColumn)))); | |||
query.ne(Purchase::getBidType, BidTypeEnum.BUILD_APP.getCode()) | |||
.exists(String.format("select 1 from nd_project_operation no" + | |||
" where no.bid_id = nd_purchase.id and no.%s is null", actualTimeColumn)); | |||
} | |||
UserFullInfoDTO user = userInfoHelper.getUserFullInfo(LoginUserUtil.getUserId()); | |||
if (!buildPurchaseQueryPermission(query, user)) { | |||
@@ -565,7 +572,7 @@ public class PurchaseManage { | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
Wrapper<Operation> update = Wrappers.lambdaUpdate(Operation.class) | |||
.set(Operation::getSelfTestTime, req.getActualTime()) | |||
.set(Operation::getActualSelfTestTime, req.getActualTime()) | |||
.set(Operation::getSelfTestFiles, req.getFiles()) | |||
.set(Operation::getSelfTestRemark, req.getRemark()) | |||
.eq(Operation::getBidId, purchase.getId()); | |||
@@ -602,7 +609,7 @@ public class PurchaseManage { | |||
Map<String, OrgInfoDTO> orgMap = declaredProjectManage.buildOrgModelMap(user.getUserId(), project); | |||
String instanceId = processInstanceService.startProcessLs(model, instParam, orgMap); | |||
Wrapper<Operation> update = Wrappers.lambdaUpdate(Operation.class) | |||
.set(Operation::getAdaptationTime, req.getActualTime()) | |||
.set(Operation::getActualAdaptionTime, req.getActualTime()) | |||
.set(Operation::getAdaptionFiles, req.getFiles()) | |||
.set(Operation::getAdaptionRemark, req.getRemark()) | |||
.eq(Operation::getBidId, purchase.getId()); | |||
@@ -3,6 +3,7 @@ package com.hz.pm.api.projectdeclared.model.req; | |||
import com.ningdatech.basic.model.PagePo; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.time.LocalDateTime; | |||
@@ -22,8 +23,10 @@ public class TestValidListReq extends PagePo { | |||
private Integer status; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") | |||
private LocalDateTime createOnMin; | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm") | |||
private LocalDateTime createOnMax; | |||
private Boolean display; | |||
@@ -1,28 +1,23 @@ | |||
package com.hz.pm.api.scheduler.task; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.staging.contants.StagingContant; | |||
import com.hz.pm.api.staging.model.entity.WorkNoticeStaging; | |||
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; | |||
import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.scheduling.annotation.Scheduled; | |||
import org.springframework.stereotype.Component; | |||
import com.alibaba.fastjson.JSON; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.hz.pm.api.scheduler.contants.TaskContant; | |||
import com.hz.pm.api.staging.contants.StagingContant; | |||
import cn.hutool.core.collection.CollUtil; | |||
import lombok.RequiredArgsConstructor; | |||
import lombok.extern.slf4j.Slf4j; | |||
import java.net.InetAddress; | |||
import java.net.UnknownHostException; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
/** | |||
* 发送工作通知定时任务 | |||
@@ -36,7 +31,6 @@ import lombok.extern.slf4j.Slf4j; | |||
public class WorkNoticeFlowTask { | |||
private final INdWorkNoticeStagingService workNoticeStagingService; | |||
private final ZwddClient zwddClient; | |||
@Value("${hostname:}") | |||
private String HOST_NAME; | |||
@@ -62,14 +56,6 @@ public class WorkNoticeFlowTask { | |||
try { | |||
WorkNoticeInfo workNoticeInfo = new WorkNoticeInfo(); | |||
BeanUtils.copyProperties(workNoticeStaging, workNoticeInfo); | |||
String receiverUserId = workNoticeInfo.getReceiverUserId(); | |||
String bizMsgId = workNoticeInfo.getBizMsgId(); | |||
String msg = workNoticeInfo.getMsg(); | |||
GenericResult<Void> result = zwddClient.sendWorkNotice(receiverUserId, bizMsgId, msg); | |||
if (result.isSuccess()) { | |||
//执行成功了 删除暂存的数据 | |||
workNoticeStagingService.removeById(workNoticeStaging); | |||
} | |||
} catch (Exception e) { | |||
log.error("发送工作通知 异常 bizMsgId:【" + workNoticeStaging.getBizMsgId() + "】 异常内容:" + e); | |||
} finally { | |||
@@ -7,8 +7,6 @@ import com.hz.pm.api.user.security.auth.constants.SessionTimeConst; | |||
import com.hz.pm.api.user.security.auth.constants.UserDetailsServiceConstant; | |||
import com.hz.pm.api.user.security.validate.CommonLoginException; | |||
import com.ningdatech.basic.exception.BizException; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.zwdd.client.ZwddAuthClient; | |||
import org.springframework.security.authentication.AuthenticationProvider; | |||
import org.springframework.security.authentication.BadCredentialsException; | |||
import org.springframework.security.core.Authentication; | |||
@@ -17,8 +15,6 @@ import org.springframework.security.core.userdetails.UserDetails; | |||
import org.springframework.security.core.userdetails.UserDetailsService; | |||
import org.springframework.security.crypto.password.PasswordEncoder; | |||
import java.util.Objects; | |||
/** | |||
* @Author LiuXinXin | |||
* @Date 2020/8/3 8:55 下午 | |||
@@ -27,11 +23,7 @@ import java.util.Objects; | |||
public class CredentialAuthProvider implements AuthenticationProvider { | |||
private UserDetailsService userDetailsService; | |||
private PasswordEncoder passwordEncoder; | |||
private ZwddAuthClient zwddAuthClient; | |||
private Boolean phoneVerifyCodeSkip; | |||
private VerifyCodeCheckHelper verifyCodeCheckHelper; | |||
@@ -49,32 +41,6 @@ public class CredentialAuthProvider implements AuthenticationProvider { | |||
LoginTypeEnum loginTypeEnum = authenticationToken.getLoginTypeEnum(); | |||
String credentials = (String) authenticationToken.getCredentials(); | |||
switch (loginTypeEnum) { | |||
case DING_QR_LOGIN: { | |||
String code = (String) authenticationToken.getCredentials(); | |||
GenericResult<String> accountResult = zwddAuthClient.getAccountId(code); | |||
if (!accountResult.isSuccess()) { | |||
throw new BadCredentialsException("login fail! 浙政钉校验失败"); | |||
} | |||
String accountId = accountResult.getData(); | |||
if (Objects.isNull(accountId)) { | |||
throw new BadCredentialsException("login fail! 浙政钉校验失败"); | |||
} | |||
user = userDetailsService.loadUserByUsername(accountId + UserDetailsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); | |||
} | |||
break; | |||
case DING_MD_LOGIN: { | |||
String code = (String) authenticationToken.getCredentials(); | |||
GenericResult<String> accountResult = zwddAuthClient.getMobileAccountId(code); | |||
if (!accountResult.isSuccess()) { | |||
throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); | |||
} | |||
String accountId = accountResult.getData(); | |||
if (Objects.isNull(accountId)) { | |||
throw new BadCredentialsException("login fail! 浙政钉免登校验失败"); | |||
} | |||
user = userDetailsService.loadUserByUsername(accountId + UserDetailsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name()); | |||
} | |||
break; | |||
case PHONE_VERIFICATION_CODE_LOGIN: { | |||
if (Boolean.FALSE.equals(phoneVerifyCodeSkip)) { | |||
// 校验短信验证码 | |||
@@ -120,10 +86,6 @@ public class CredentialAuthProvider implements AuthenticationProvider { | |||
this.passwordEncoder = passwordEncoder; | |||
} | |||
public void setZwddAuthClient(ZwddAuthClient zwddAuthClient) { | |||
this.zwddAuthClient = zwddAuthClient; | |||
} | |||
public void setVerifyCodeCheckHelper(VerifyCodeCheckHelper verifyCodeCheckHelper) { | |||
this.verifyCodeCheckHelper = verifyCodeCheckHelper; | |||
} | |||
@@ -2,7 +2,6 @@ package com.hz.pm.api.user.security.auth.credential; | |||
import com.hz.pm.api.sms.helper.VerifyCodeCheckHelper; | |||
import com.hz.pm.api.user.security.config.AuthProperties; | |||
import com.ningdatech.zwdd.client.ZwddAuthClient; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.beans.factory.annotation.Value; | |||
@@ -30,28 +29,19 @@ public class CredentialAuthSecurityConfig extends SecurityConfigurerAdapter<Defa | |||
@Value("${login.phone-verify-code.skip:false}") | |||
private Boolean skipLoginVerifyCodeCheck; | |||
@Autowired | |||
@Qualifier(value = "defaultLoginSuccessHandler") | |||
protected AuthenticationSuccessHandler defaultLoginSuccessHandler; | |||
@Autowired | |||
@Qualifier(value = "defaultLoginFailureHandler") | |||
protected AuthenticationFailureHandler defaultLoginFailureHandler; | |||
@Autowired | |||
@Qualifier(value = "credentialLoginUserDetailService") | |||
private UserDetailsService credentialLoginUserDetailService; | |||
@Autowired | |||
private PasswordEncoder passwordEncoder; | |||
@Autowired | |||
private AuthProperties authProperties; | |||
@Autowired | |||
private ZwddAuthClient zwddAuthClient; | |||
@Autowired | |||
private VerifyCodeCheckHelper verifyCodeCheckHelper; | |||
@@ -70,7 +60,6 @@ public class CredentialAuthSecurityConfig extends SecurityConfigurerAdapter<Defa | |||
// 确保对密码进行加密的encoder和解密的encoder相同 | |||
authenticationProvider.setPasswordEncoder(passwordEncoder); | |||
// 传入浙政钉client | |||
authenticationProvider.setZwddAuthClient(zwddAuthClient); | |||
authenticationProvider.setVerifyCodeCheckHelper(verifyCodeCheckHelper); | |||
http.authenticationProvider(authenticationProvider).addFilterAfter(credentialAuthFilter, | |||
@@ -1,228 +0,0 @@ | |||
package com.hz.pm.api.irs; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.xxpt.gateway.shared.client.http.ExecutableClient; | |||
import com.alibaba.xxpt.gateway.shared.client.http.GetClient; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.common.util.CryptUtils; | |||
import com.hz.pm.api.common.util.HmacAuthUtil; | |||
import com.hz.pm.api.common.util.RefreshKeyUtil; | |||
import com.ningdatech.zwdd.ZwddIntegrationProperties; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.ningdatech.zwdd.client.provider.ZwddAuthClientProvider; | |||
import org.apache.http.client.methods.CloseableHttpResponse; | |||
import org.junit.Test; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpEntity; | |||
import org.springframework.http.HttpHeaders; | |||
import org.springframework.http.HttpMethod; | |||
import org.springframework.http.ResponseEntity; | |||
import org.springframework.util.MultiValueMap; | |||
import org.springframework.web.client.RestTemplate; | |||
import java.io.File; | |||
import java.io.FileOutputStream; | |||
import java.io.InputStream; | |||
import java.io.OutputStream; | |||
import java.security.NoSuchAlgorithmException; | |||
import java.util.Map; | |||
import java.util.Objects; | |||
/** | |||
* @Classname IrsTest | |||
* @Description | |||
* @Date 2023/6/26 17:42 | |||
* @Author PoffyZhang | |||
*/ | |||
public class IrsTest extends AppTests { | |||
@Autowired | |||
private ZwddClient zwddClient; | |||
@Test | |||
public void test1() { | |||
String method = "GET"; | |||
String url = "https://bcdsg.zj.gov.cn:8443/restapi/prod/IC33000020230427000001/irs-res-bill/report/pdfUrl" + | |||
"?appCode=A331123467587202210014168"; | |||
String appScret = "BCDSGS_4ab4235d26a9a357170a39f3a13fd68c"; | |||
String appKey = "BCDSGA_d874c8e46b541eb4e8aac6510fd3351b"; | |||
Map<String, String> header = HmacAuthUtil.generateHeader(url, method, appKey, appScret); | |||
//请求头 | |||
HttpHeaders headers = new HttpHeaders(); | |||
for (Map.Entry<String, String> entry : header.entrySet()) { | |||
headers.add(entry.getKey(), entry.getValue()); | |||
} | |||
//封装请求头 | |||
HttpEntity<MultiValueMap<String, Object>> formEntity = new HttpEntity<MultiValueMap<String, Object>>(headers); | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<String> forEntity = restTemplate.exchange(url, HttpMethod.GET, formEntity, String.class); | |||
System.out.println(JSON.toJSONString(forEntity)); | |||
} | |||
@Test | |||
public void testApp() throws NoSuchAlgorithmException { | |||
long timestamp = System.currentTimeMillis(); | |||
String areaCode = "331123"; | |||
String appScret = "496f0f2a19994f76b4fd9dae087366c7"; | |||
String appKey = "A331101453557202109017383"; | |||
String appCode = "A331123467587202307014177";//A331123467587202307014171 | |||
String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret, timestamp); | |||
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); | |||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/001003001029/dataSharing/XS8daav3bcemZ3Ra.htm?" + | |||
"requestTime=" + timestamp + "&sign=" + sign + "&appKey=" + appKey + "&name=&" + | |||
"pageSize=10&deptCode=&areaCode=" + areaCode + "&pageNum=1&appCode=" + appCode; | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
System.out.println(JSON.toJSONString(forEntity)); | |||
} | |||
@Test | |||
public void test2() throws NoSuchAlgorithmException { | |||
long timestamp = System.currentTimeMillis(); | |||
String areaCode = "331123"; | |||
String appKey = "A331101453557202109017383"; | |||
String appScret = "496f0f2a19994f76b4fd9dae087366c7"; | |||
String baseProjSys = "初次建设的应用21"; | |||
String baseProjSysCode = "A331123467587202307014177"; | |||
String baseProjName = "遂昌县-nsl-项目测试004"; | |||
String baseProjId = "331123230130123412186"; | |||
String requestSecret = RefreshKeyUtil.getRequestSecret(appKey, appScret, timestamp); | |||
String capCode = CryptUtils.MD5Encode(timestamp + areaCode); | |||
String capTime = String.valueOf(timestamp); | |||
String sign = CryptUtils.MD5Encode(appKey + requestSecret + timestamp); | |||
String url = "https://interface.zjzwfw.gov.cn/gateway/api/proxy/001003001029/dataSharing/94wbaL1I1Pbz0648.htm?requestTime=" + timestamp + | |||
"&sign=" + sign + "&appKey=" + appKey + "&capCode=" + capCode + "&capTime=" + capTime + | |||
"&baseProjSys=" + baseProjSys + "&areaCode=331123&baseProjName=" + baseProjName + "&baseProjId=" + baseProjId + | |||
"&isEffective=1&baseProjSysCode=" + baseProjSysCode; | |||
RestTemplate restTemplate = new RestTemplate(); | |||
ResponseEntity<String> forEntity = restTemplate.getForEntity(url, String.class); | |||
System.out.println(JSON.toJSONString(forEntity)); | |||
} | |||
@Test | |||
public void test3() throws NoSuchAlgorithmException { | |||
long timestamp = System.currentTimeMillis(); | |||
String areaCode = "331121"; | |||
System.out.println(CryptUtils.MD5Encode(timestamp + areaCode)); | |||
} | |||
@Test | |||
public void test4() { | |||
CloseableHttpResponse response = null; | |||
try { | |||
String api = "/media/download"; | |||
GetClient getClient = getZwddExecutableClient().newGetClient(api); | |||
//设置参数 | |||
getClient.addParameter("access_token", zwddClient.getAccessToken().getData()); | |||
getClient.addParameter("media_id", "$hQHNKaUCo2pwZwMGDAEN2gBAK2Z2YUVMb0xYZnFJSGRuZ1h3OVZGd3hadDNrTXlYNWlQOXF0OERrZTc0b2M5UU0xeExsUVFkalBQNFVJakZ0aA"); | |||
//调用API | |||
//String result = getClient.get(); | |||
//System.err.println(result); | |||
response = getClient.getB(); | |||
org.apache.http.HttpEntity entity = response.getEntity(); | |||
InputStream is = entity.getContent(); | |||
System.out.println(is); | |||
File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg"); | |||
OutputStream fos = new FileOutputStream(voice); | |||
int cache = 10 * 1024; | |||
byte[] buffer = new byte[cache]; | |||
int ch = 0; | |||
StringBuffer sb = new StringBuffer(); | |||
while ((ch = is.read(buffer)) != -1) { | |||
fos.write(buffer, 0, ch); | |||
sb.append(buffer); | |||
} | |||
System.out.println(sb.toString()); | |||
is.close(); | |||
fos.flush(); | |||
fos.close(); | |||
} catch (Exception e) { | |||
System.out.println(e); | |||
} finally { | |||
if (response != null) { | |||
try { | |||
//特别提醒:需要调用response的close方法关闭网络连接!!! | |||
response.close(); | |||
} catch (Exception e) { | |||
System.out.println(e); | |||
} | |||
} | |||
} | |||
} | |||
@Test | |||
public void test5() { | |||
CloseableHttpResponse response = null; | |||
try { | |||
String api = "/media/download"; | |||
GetClient getClient = getZwddExecutableClient().newGetClient(api); | |||
//设置参数 | |||
getClient.addParameter("access_token", zwddClient.getAccessToken().getData()); | |||
getClient.addParameter("media_id", "$hQHNxoECo2pwZwMGDAEN2gAsOEkvNENaMmZ5UUVncDduWERralJxRW5aem45ODN5UHpKRjErcUxFeUkvTT0"); | |||
//调用API | |||
//String result = getClient.get(); | |||
//System.err.println(result); | |||
response = getClient.getB(); | |||
org.apache.http.HttpEntity entity = response.getEntity(); | |||
InputStream is = entity.getContent(); | |||
System.out.println(is); | |||
File voice = new File("C:\\Users\\PoffyZhang\\Desktop\\log1.jpg"); | |||
OutputStream fos = new FileOutputStream(voice); | |||
int cache = 10 * 1024; | |||
byte[] buffer = new byte[cache]; | |||
int ch = 0; | |||
StringBuffer sb = new StringBuffer(); | |||
while ((ch = is.read(buffer)) != -1) { | |||
fos.write(buffer, 0, ch); | |||
sb.append(buffer); | |||
} | |||
System.out.println(sb.toString()); | |||
is.close(); | |||
fos.flush(); | |||
fos.close(); | |||
} catch (Exception e) { | |||
System.out.println(e); | |||
} finally { | |||
if (response != null) { | |||
try { | |||
//特别提醒:需要调用response的close方法关闭网络连接!!! | |||
response.close(); | |||
} catch (Exception e) { | |||
System.out.println(e); | |||
} | |||
} | |||
} | |||
} | |||
private static ExecutableClient zwddExecutableClient; | |||
@Autowired | |||
private ZwddIntegrationProperties zwddProperties; | |||
public ExecutableClient getZwddExecutableClient() { | |||
if (Objects.isNull(zwddExecutableClient)) { | |||
synchronized (ZwddAuthClientProvider.class) { | |||
if (Objects.isNull(zwddExecutableClient)) { | |||
zwddExecutableClient = ExecutableClient.getInstance(); | |||
//DomainName不同环境对应不同域名,示例为sass域名 | |||
zwddExecutableClient.setDomainName(zwddProperties.getDomain()); | |||
zwddExecutableClient.setProtocal("https"); | |||
//应用App Key | |||
zwddExecutableClient.setAccessKey(zwddProperties.getAppKey()); | |||
//应用App Secret | |||
zwddExecutableClient.setSecretKey(zwddProperties.getAppSecret()); | |||
zwddExecutableClient.init(); | |||
} | |||
} | |||
} | |||
return zwddExecutableClient; | |||
} | |||
} |
@@ -1,181 +0,0 @@ | |||
package com.hz.pm.api.organization; | |||
import cn.hutool.core.collection.CollUtil; | |||
import com.alibaba.fastjson.JSON; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; | |||
import com.google.common.collect.Lists; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.ding.model.DingOrgInfoTreeDTO; | |||
import com.hz.pm.api.ding.task.GovBusinessStripsTask; | |||
import com.hz.pm.api.organization.model.entity.DingOrganization; | |||
import com.hz.pm.api.organization.service.IDingOrganizationService; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.ningdatech.zwdd.model.dto.*; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.junit.jupiter.api.Test; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import java.util.*; | |||
import java.util.stream.Collectors; | |||
/** | |||
* @author liuxinxin | |||
* @date 2023/2/9 下午3:54 | |||
*/ | |||
@Slf4j | |||
class OrganizationTest extends AppTests { | |||
@Autowired | |||
private GovBusinessStripsTask govBusinessStripsTask; | |||
@Autowired | |||
private ZwddClient zwddClient; | |||
@Autowired | |||
private IDingOrganizationService organizationService; | |||
private static final Integer GROUP_SIZE = 100; | |||
@Test | |||
public void testGovBusinessStripsTask() { | |||
govBusinessStripsTask.batchGetGovBusinessStripsTask(); | |||
} | |||
@Test | |||
public void getEmployeeInfo() { | |||
GenericResult<DingInfoByMobileDTO> dingInfoByMobile = zwddClient.getDingInfoByMobile("13164388876"); | |||
// GenericResult<EmployeeInfoDTO> ge_809a061236b941d281446df6f14dc8f0 = zwddClient.getEmployeeByCode("GE_809a061236b941d281446df6f14dc8f0"); | |||
GenericResult<EmployeeInfoDTO> ge_809a061236b941d281446df6f14dc8f0 = zwddClient.getEmployeeByCode("GE_e68c7af513474eaa959b7ce7141a4d9f"); | |||
System.out.println("---"); | |||
} | |||
@Test | |||
public void test2() { | |||
// 获取顶级组织code | |||
GenericResult<DingScopesV2DTO> scopesV2Result = zwddClient.getScopesV2(); | |||
DingScopesV2DTO scopesV2 = scopesV2Result.getData(); | |||
if (Objects.nonNull(scopesV2)) { | |||
List<DingOrganization> currentAllOrganizationList = organizationService.list(); | |||
// 顶级组织code | |||
List<String> deptVisibleScopes = scopesV2.getDeptVisibleScopes(); | |||
log.info("顶级组织code: size = " + deptVisibleScopes.size() + "列表:" + JSONObject.toJSONString(deptVisibleScopes)); | |||
// 获取顶级节点信息 | |||
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient.listOrganizationsByCodes(deptVisibleScopes); | |||
log.info("listGenericResult: {}" + JSON.toJSONString(listGenericResult)); | |||
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData(); | |||
for (String orgCode : deptVisibleScopes) { | |||
List<DingOrgInfoTreeDTO> treeDTOList = new ArrayList<>(); | |||
DingOrgInfoTreeDTO childDingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); | |||
//设置节点详情 | |||
if (dingOrgInfoDtos != null && !dingOrgInfoDtos.isEmpty()) { | |||
for (DingOrgInfoDTO orgInfo : dingOrgInfoDtos) { | |||
if (orgInfo.getOrganizationCode().equals(orgCode)) { | |||
childDingOrgInfoTreeDTO.setDingOrgInfoDTO(orgInfo); | |||
} | |||
} | |||
} | |||
childDingOrgInfoTreeDTO.setCode(orgCode); | |||
childDingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); | |||
getDingOrgChild(childDingOrgInfoTreeDTO); | |||
treeDTOList.add(childDingOrgInfoTreeDTO); | |||
if (CollectionUtils.isNotEmpty(treeDTOList)) { | |||
List<DingOrganization> saveRecordList = new ArrayList<>(); | |||
buildSaveRecordList(treeDTOList, saveRecordList, currentAllOrganizationList); | |||
// 批量保存 | |||
if (saveRecordList.size() <= GROUP_SIZE) { | |||
organizationService.saveOrUpdateBatch(saveRecordList); | |||
} else { | |||
List<List<DingOrganization>> split = Lists.partition(saveRecordList, GROUP_SIZE); | |||
for (List<DingOrganization> segment : split) { | |||
organizationService.saveOrUpdateBatch(segment); | |||
} | |||
} | |||
} | |||
log.info("----拉取浙政钉组织结构结束---,顶级code:" + orgCode); | |||
} | |||
} | |||
} | |||
private void getDingOrgChild(DingOrgInfoTreeDTO parentDingOrgInfoTreeDTO) { | |||
String parentOrgCode = parentDingOrgInfoTreeDTO.getCode(); | |||
DingOrgInfoDTO orgInfoDTO = parentDingOrgInfoTreeDTO.getDingOrgInfoDTO(); | |||
boolean leaf = orgInfoDTO.getLeaf(); | |||
if (!leaf) { | |||
int currentPage = 1; | |||
int pageSize = 100; | |||
GenericResult<PageSubOrganizationCodeDTO> pageSubOrganizationCodeDTOGenericResult = zwddClient.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); | |||
PageSubOrganizationCodeDTO pageSubOrganizationCodeDTO = pageSubOrganizationCodeDTOGenericResult.getData(); | |||
if (CollUtil.isNotEmpty(pageSubOrganizationCodeDTO.getSubOrganizationCodeList())) { | |||
List<String> subOrganizationCodeList = new ArrayList<>(pageSubOrganizationCodeDTO.getSubOrganizationCodeList()); | |||
Long totalSize = pageSubOrganizationCodeDTO.getTotalSize(); | |||
while (totalSize > (long) currentPage * pageSize) { | |||
GenericResult<PageSubOrganizationCodeDTO> subPageSubOrganizationCodeDTOGenericResult = zwddClient | |||
.pageSubOrganizationCodes(currentPage++, pageSize, parentOrgCode); | |||
PageSubOrganizationCodeDTO subOrganizationCodeDTO = subPageSubOrganizationCodeDTOGenericResult.getData(); | |||
if (CollectionUtils.isNotEmpty(subOrganizationCodeDTO.getSubOrganizationCodeList())) { | |||
subOrganizationCodeList.addAll(subOrganizationCodeDTO.getSubOrganizationCodeList()); | |||
} | |||
} | |||
if (CollectionUtils.isNotEmpty(subOrganizationCodeList)) { | |||
GenericResult<List<DingOrgInfoDTO>> listGenericResult = zwddClient | |||
.listOrganizationsByCodes(subOrganizationCodeList); | |||
List<DingOrgInfoDTO> dingOrgInfoDtos = listGenericResult.getData(); | |||
List<DingOrgInfoTreeDTO> dingOrgInfoTreeDTOList = dingOrgInfoDtos.stream().map(r -> { | |||
DingOrgInfoTreeDTO dingOrgInfoTreeDTO = new DingOrgInfoTreeDTO(); | |||
dingOrgInfoTreeDTO.setCode(r.getOrganizationCode()); | |||
dingOrgInfoTreeDTO.setDingOrgInfoDTO(r); | |||
dingOrgInfoTreeDTO.setChildCodes(new ArrayList<>()); | |||
getDingOrgChild(dingOrgInfoTreeDTO); | |||
return dingOrgInfoTreeDTO; | |||
}).collect(Collectors.toList()); | |||
parentDingOrgInfoTreeDTO.setChildCodes(dingOrgInfoTreeDTOList); | |||
} | |||
} | |||
} | |||
} | |||
private void buildSaveRecordList(List<DingOrgInfoTreeDTO> treeDTOList, List<DingOrganization> saveRecordList, | |||
List<DingOrganization> oldList) { | |||
Set<String> set = new HashSet(); | |||
Map<String, DingOrganization> map = oldList.stream() | |||
.filter(o -> set.add(o.getOrganizationCode())) | |||
.collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); | |||
if (CollectionUtils.isEmpty(treeDTOList)) { | |||
return; | |||
} | |||
for (DingOrgInfoTreeDTO dingOrgInfoTreeDTO : treeDTOList) { | |||
DingOrganization saveRecord = new DingOrganization(); | |||
DingOrgInfoDTO dingOrgInfoDTO = dingOrgInfoTreeDTO.getDingOrgInfoDTO(); | |||
List<DingOrgInfoTreeDTO> childCodes = dingOrgInfoTreeDTO.getChildCodes(); | |||
if (map.containsKey(dingOrgInfoDTO.getOrganizationCode())) { | |||
DingOrganization organization = map.get(dingOrgInfoDTO.getOrganizationCode()); | |||
saveRecord.setId(organization.getId()); | |||
if (CollectionUtils.isNotEmpty(childCodes)) { | |||
buildSaveRecordList(childCodes, saveRecordList, oldList); | |||
} | |||
continue; | |||
} | |||
saveRecord.setDisplayOrder(dingOrgInfoDTO.getDisplayOrder()); | |||
saveRecord.setParentCode(dingOrgInfoDTO.getParentCode()); | |||
saveRecord.setTypeCode(dingOrgInfoDTO.getTypeCode()); | |||
saveRecord.setTypeName(dingOrgInfoDTO.getTypeName()); | |||
saveRecord.setOrganizationCode(dingOrgInfoDTO.getOrganizationCode()); | |||
saveRecord.setOrganizationName(dingOrgInfoDTO.getOrganizationName()); | |||
saveRecord.setDivisionCode(dingOrgInfoDTO.getDivisionCode()); | |||
saveRecordList.add(saveRecord); | |||
if (CollectionUtils.isNotEmpty(childCodes)) { | |||
buildSaveRecordList(childCodes, saveRecordList, oldList); | |||
} | |||
} | |||
} | |||
} |
@@ -1,224 +0,0 @@ | |||
package com.hz.pm.api.todocenter; | |||
import cn.hutool.core.util.StrUtil; | |||
import com.alibaba.fastjson.JSONObject; | |||
import com.ningdatech.basic.model.GenericResult; | |||
import com.ningdatech.basic.util.NdDateUtils; | |||
import com.ningdatech.file.entity.vo.result.FileResultVO; | |||
import com.ningdatech.file.service.FileService; | |||
import com.hz.pm.api.AppTests; | |||
import com.hz.pm.api.projectlib.model.enumeration.ProjectTypeNewEnum; | |||
import com.hz.pm.api.projectlib.manage.ProjectLibManage; | |||
import com.hz.pm.api.projectlib.model.entity.Project; | |||
import com.hz.pm.api.projectlib.model.vo.ProjectDetailVO; | |||
import com.hz.pm.api.projectlib.service.IProjectService; | |||
import com.hz.pm.api.staging.service.INdWorkNoticeStagingService; | |||
import com.hz.pm.api.sys.manage.NoticeManage; | |||
import com.hz.pm.api.todocenter.bean.entity.WorkNoticeInfo; | |||
import com.hz.pm.api.todocenter.manage.TodoCenterManage; | |||
import com.hz.pm.api.todocenter.model.dto.PdfGenerateDTO; | |||
import com.hz.pm.api.todocenter.utils.PdfUtil; | |||
import com.hz.pm.api.user.service.IUserInfoService; | |||
import com.ningdatech.zwdd.client.ZwddClient; | |||
import com.wflow.contants.ProcessConstant; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.flowable.engine.HistoryService; | |||
import org.flowable.engine.TaskService; | |||
import org.flowable.task.api.Task; | |||
import org.flowable.task.api.TaskQuery; | |||
import org.flowable.task.api.history.HistoricTaskInstance; | |||
import org.flowable.task.service.history.NativeHistoricTaskInstanceQuery; | |||
import org.junit.Test; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.mock.web.MockMultipartFile; | |||
import org.springframework.web.multipart.MultipartFile; | |||
import java.io.IOException; | |||
import java.io.InputStream; | |||
import java.time.LocalDateTime; | |||
import java.util.List; | |||
import java.util.concurrent.*; | |||
import static com.hz.pm.api.todocenter.constant.WorkNoticeConst.PASS_MSG_TEMPLATE; | |||
/** | |||
* 待办中心测试 | |||
* | |||
* @author CMM | |||
* @since 2023/02/15 22:03 | |||
*/ | |||
@Slf4j | |||
public class TodoCenterTest extends AppTests { | |||
@Autowired | |||
private TodoCenterManage todoCenterManage; | |||
@Autowired | |||
private IUserInfoService userInfoService; | |||
@Autowired | |||
private ZwddClient zwddClient; | |||
@Autowired | |||
private INdWorkNoticeStagingService workNoticeStagingService; | |||
@Autowired | |||
private ProjectLibManage projectLibManage; | |||
@Autowired | |||
private FileService fileService; | |||
@Autowired | |||
private IProjectService projectService; | |||
@Autowired | |||
private PdfUtil pdfUtil; | |||
@Autowired | |||
private TaskService taskService; | |||
@Autowired | |||
private HistoryService historyService; | |||
@Autowired | |||
private NoticeManage handlerManage; | |||
@Test | |||
public void sendWorkNoticeTest() throws ExecutionException, InterruptedException { | |||
//String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-00-测试项目"); | |||
//log.info("开始发送工作通知"); | |||
//zwddClient.sendWorkNotice("846085", "0223-00", msg); | |||
//// zwddClient.sendWorkNotice("829728","0216-5",msg); | |||
//log.info("发送工作通知结束"); | |||
//ApplicationContext ac = new AnnotationConfigApplicationContext(BeanConfig.class); | |||
// | |||
////若没有指定属性名,则默认为方法名 | |||
//TaskExecutor taskExecutor = (TaskExecutor) ac.getBean("executor"); | |||
String userId = "4"; | |||
// 获取发送浙政钉工作通知必要信息 | |||
WorkNoticeInfo workNoticeInfo = handlerManage.getSendWorkNoticeInfo(userId); | |||
// workNoticeInfo.setBizMsgId("1"); | |||
String msg = String.format(PASS_MSG_TEMPLATE, "发改委", "0223-02-测试项目"); | |||
//// 先创建1个活动线程的线程池 | |||
//ExecutorService executor = Executors.newFixedThreadPool(1); | |||
// 初始化线程池 | |||
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(10, 20, | |||
60, TimeUnit.SECONDS, new ArrayBlockingQueue(20), new ThreadPoolExecutor.AbortPolicy()); | |||
// 将发送工作通知交给异步任务Future | |||
CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> { | |||
// 调用浙政钉的接口发送工作通知 | |||
long startTime = System.currentTimeMillis(); | |||
GenericResult<Void> result = | |||
zwddClient.sendWorkNotice(workNoticeInfo.getReceiverUserId(), workNoticeInfo.getBizMsgId(), msg); | |||
String resultMsg = result.getMsg(); | |||
if (resultMsg.equals("success")) { | |||
log.info("异步任务执行完成, " + workNoticeInfo.getBizMsgId() + " 当前线程:" + Thread.currentThread().getName()); | |||
long endTime = System.currentTimeMillis(); | |||
log.info("方法执行完成返回,耗时:" + (endTime - startTime)); | |||
}else { | |||
return "发送工作通知失败!"; | |||
} | |||
return "发送工作通知成功!"; | |||
}, threadPool); | |||
String s = future.get(); | |||
threadPool.shutdown(); | |||
while (threadPool.isTerminated()) { | |||
log.info(s); | |||
break; | |||
} | |||
} | |||
@Test | |||
public void sendWorkNoticeTest2(){ | |||
String userId = "2"; | |||
// 获取发送浙政钉工作通知必要信息 | |||
WorkNoticeInfo passWorkNoticeInfo = handlerManage.getSendWorkNoticeInfo(userId); | |||
String passMsg = String.format(PASS_MSG_TEMPLATE, passWorkNoticeInfo.getOrganizationName(), "测试项目0301-1"); | |||
passWorkNoticeInfo.setMsg(passMsg); | |||
// 放入工作通知暂存表中,通过扫表异步发送 | |||
// workNoticeStagingService.addByWorkNotice(passWorkNoticeInfo, MsgTypeEnum.AUDIT); | |||
} | |||
@Test | |||
public void GeneratePdf(){ | |||
// 获取本地目录的pdf模板 | |||
String fileName = "预审申请单"; | |||
InputStream htmlInputStream = | |||
this.getClass().getClassLoader().getResourceAsStream("template/" + fileName + ".html"); | |||
// 获取表单数据 | |||
ProjectDetailVO projectDetail = projectLibManage.getProjectDetail(44L); | |||
PdfGenerateDTO pdfGenerateDTO = new PdfGenerateDTO(); | |||
BeanUtils.copyProperties(projectDetail, pdfGenerateDTO); | |||
// 设置pdf模板参数 | |||
JSONObject paramsMap = JSONObject.parseObject(JSONObject.toJSONString(pdfGenerateDTO)); | |||
paramsMap.put("time", NdDateUtils.format(LocalDateTime.now(), "yyyy-MM-dd HH:mm")); | |||
paramsMap.put("isTemporaryAugment", "否"); | |||
String projectType = projectDetail.getProjectType(); | |||
paramsMap.put("projectType", ProjectTypeNewEnum.getDesc(projectType)); | |||
Integer isFirst = projectDetail.getIsFirst(); | |||
paramsMap.put("isFirst", "是"); | |||
Boolean isInnovateWholeProvinceShare = projectDetail.getIsInnovateWholeProvinceShare(); | |||
paramsMap.put("isInnovateWholeProvinceShare", Boolean.TRUE.equals(isInnovateWholeProvinceShare) ? "是" : "否"); | |||
String beginTime = projectDetail.getBeginTime(); | |||
String endTime = projectDetail.getEndTime(); | |||
String beginAndEndTime = beginTime + StrUtil.DASHED + endTime; | |||
paramsMap.put("beginAndEndTime", beginAndEndTime); | |||
Integer fourSystems = projectDetail.getFourSystems(); | |||
paramsMap.put("fourSystems", "业务应用"); | |||
Integer isDigitalReform = projectDetail.getIsDigitalReform(); | |||
paramsMap.put("isDigitalReform", "否"); | |||
Integer isCloud = projectDetail.getIsCloud(); | |||
paramsMap.put("isCloud", "否"); | |||
paramsMap.put("yearPlanInvest",null); | |||
paramsMap.put("bigDataBureauName",null); | |||
// 生成pdf字节数组 | |||
byte[] pdf = pdfUtil.generatePdf(htmlInputStream, paramsMap); | |||
// 转换成MultipartFile | |||
MultipartFile multipartFile = new MockMultipartFile("file", fileName + ".pdf", "application/pdf", pdf); | |||
// 上传OSS | |||
FileResultVO resultVO = fileService.upload(multipartFile, "default"); | |||
// 将返回的文件ID保存到项目库中 | |||
Project project = projectService.getById(44L); | |||
project.setPretrialFileId(resultVO.getId()); | |||
try { | |||
if (null != htmlInputStream) { | |||
htmlInputStream.close(); | |||
} | |||
} catch (IOException e) { | |||
e.printStackTrace(); | |||
} | |||
} | |||
@Test | |||
public void todo(){ | |||
//测试 有多少个 | |||
TaskQuery taskQuery = taskService.createTaskQuery(); | |||
taskQuery.active() | |||
.taskCandidateOrAssigned(String.valueOf(2)); | |||
List<Task> taskList = taskQuery.list(); | |||
System.out.println(taskList.size()); | |||
} | |||
public void ido(){ | |||
String userId = "2"; | |||
// 自定义sql查询所有已办的任务实例 | |||
String nativeSql = "SELECT\n" + | |||
"\taht.*\n" + | |||
"FROM\n" + | |||
"\tACT_HI_TASKINST AS aht\n" + | |||
"LEFT JOIN ACT_HI_VARINST AS ahv ON\n" + | |||
"\tSUBSTRING(ahv.NAME_, 9) = aht.ID_\n" + | |||
"\tAND ahv.NAME_ LIKE 'approve_%'\n" + | |||
"WHERE\n" + | |||
"\taht.ASSIGNEE_ = '" + userId + | |||
"'AND ahv.NAME_ IS NOT NULL\n" + | |||
"\tOR aht.DELETE_REASON_ = '" + ProcessConstant.Field.CANCEL + "'"; | |||
NativeHistoricTaskInstanceQuery taskInstanceQuery = | |||
historyService.createNativeHistoricTaskInstanceQuery().sql(nativeSql); | |||
List<HistoricTaskInstance> taskInstances = taskInstanceQuery.list(); | |||
System.out.println(taskInstances.size()); | |||
} | |||
} |
@@ -55,7 +55,7 @@ public class CodeGen { | |||
} | |||
public static void main(String[] args) { | |||
generate("WendyYang", "sys", PATH_YYD, "nd_staging"); | |||
generate("WendyYang", "projectlib", PATH_YYD, "nd_purchase_status_change"); | |||
} | |||
} |