@@ -87,6 +87,13 @@ public interface BizConst { | |||||
int MAX_EXPORT_COUNT = 5000; | int MAX_EXPORT_COUNT = 5000; | ||||
String RESPONSE_KEY_DATA = "data"; | String RESPONSE_KEY_DATA = "data"; | ||||
String RESPONSE_KEY_ID = "id"; | |||||
String RESPONSE_KEY_DING_CODE = "dingCode"; | |||||
String RESPONSE_KEY_MATTER_NAME = "matterName"; | |||||
String RESPONSE_KEY_ORG_NAME = "orgName"; | |||||
String RESPONSE_KEY_USER_STATE = "userState"; | |||||
String RESPONSE_KEY_AREA_NAME = "areaName"; | |||||
String ORG_NAME = "organizationName"; | String ORG_NAME = "organizationName"; | ||||
String ORG_CODE = "organizationCode"; | String ORG_CODE = "organizationCode"; | ||||
@@ -64,6 +64,6 @@ public interface CommonConst { | |||||
Integer VERIFY_TYPE = 2; | Integer VERIFY_TYPE = 2; | ||||
String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!"; | String REPEAT = " 已在其他当前评价计划其他分组中,请勿重复添加!"; | ||||
String NORMAL_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; | |||||
} | } |
@@ -111,4 +111,11 @@ public class GovProjectCollectionController { | |||||
public void stagingConvertPdf(@RequestParam(required = false) String projId) { | public void stagingConvertPdf(@RequestParam(required = false) String projId) { | ||||
collectionTask.stagingConvertPdf(projId); | collectionTask.stagingConvertPdf(projId); | ||||
} | } | ||||
@PostMapping("/staging-convert-pdf2") | |||||
@ApiOperation("把库存的项目归集的文件approval_file重新转换") | |||||
@WebLog("把库存的项目归集的文件approval_file重新转换") | |||||
public void stagingConvertPdf2(@RequestParam(required = false) String projId) { | |||||
collectionTask.stagingConvertPdf2(projId); | |||||
} | |||||
} | } |
@@ -2,12 +2,15 @@ package com.ningdatech.pmapi.gov.convert; | |||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import cn.hutool.core.collection.CollUtil; | import cn.hutool.core.collection.CollUtil; | ||||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||||
import com.ningdatech.pmapi.gov.contants.BizProjectContant; | import com.ningdatech.pmapi.gov.contants.BizProjectContant; | ||||
import com.ningdatech.pmapi.gov.model.dto.*; | import com.ningdatech.pmapi.gov.model.dto.*; | ||||
import com.ningdatech.pmapi.gov.model.req.*; | import com.ningdatech.pmapi.gov.model.req.*; | ||||
import com.ningdatech.pmapi.gov.model.vo.*; | import com.ningdatech.pmapi.gov.model.vo.*; | ||||
import com.ningdatech.pmapi.gov.utils.ProjectCollectionUtil; | |||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import java.time.format.DateTimeFormatter; | |||||
import java.util.Collections; | import java.util.Collections; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | import java.util.Objects; | ||||
@@ -70,6 +73,8 @@ public class ProjectConvert { | |||||
if(Objects.nonNull(p.getId())){ | if(Objects.nonNull(p.getId())){ | ||||
r.setTongID(p.getId().intValue()); | r.setTongID(p.getId().intValue()); | ||||
} | } | ||||
r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); | |||||
r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); | |||||
return r; | return r; | ||||
}) | }) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
@@ -87,6 +92,8 @@ public class ProjectConvert { | |||||
if(Objects.nonNull(p.getId())){ | if(Objects.nonNull(p.getId())){ | ||||
r.setTongID(p.getId().intValue()); | r.setTongID(p.getId().intValue()); | ||||
} | } | ||||
r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); | |||||
r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); | |||||
return r; | return r; | ||||
}) | }) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
@@ -107,6 +114,8 @@ public class ProjectConvert { | |||||
p.getPurchaseFile()); | p.getPurchaseFile()); | ||||
r.setPurchaseContract(StringUtils.isNotBlank(p.getPurchaseContractPdf()) ? p.getPurchaseContractPdf() : | r.setPurchaseContract(StringUtils.isNotBlank(p.getPurchaseContractPdf()) ? p.getPurchaseContractPdf() : | ||||
p.getPurchaseContract()); | p.getPurchaseContract()); | ||||
r.setBaseWinningBidTime(ProjectCollectionUtil.convertLocalDateTime(p.getBaseWinningBidTime())); | |||||
r.setBasePaymentTime(ProjectCollectionUtil.convertLocalDateTime(p.getBasePaymentTime())); | |||||
return r; | return r; | ||||
}) | }) | ||||
.collect(Collectors.toList()); | .collect(Collectors.toList()); | ||||
@@ -301,8 +310,8 @@ public class ProjectConvert { | |||||
req.setBaseProjConsClass(apply.getBaseProjConsClass()); | req.setBaseProjConsClass(apply.getBaseProjConsClass()); | ||||
req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); | req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); | ||||
req.setBaseProjIntro(apply.getBaseProjIntro()); | req.setBaseProjIntro(apply.getBaseProjIntro()); | ||||
req.setBaseProjStartTime(String.valueOf(apply.getBaseProjStartTime())); | |||||
req.setBaseProjEndTime(String.valueOf(apply.getBaseProjEndTime())); | |||||
req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); | |||||
req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); | |||||
req.setBaseProjSetYear(apply.getBaseProjSetYear()); | req.setBaseProjSetYear(apply.getBaseProjSetYear()); | ||||
req.setBaseProjSys(apply.getBaseProjSys()); | req.setBaseProjSys(apply.getBaseProjSys()); | ||||
req.setBaseProjSysCode(apply.getBaseDevelopCode()); | req.setBaseProjSysCode(apply.getBaseDevelopCode()); | ||||
@@ -342,8 +351,8 @@ public class ProjectConvert { | |||||
req.setBaseProjConsClass(apply.getBaseProjConsClass()); | req.setBaseProjConsClass(apply.getBaseProjConsClass()); | ||||
req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); | req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); | ||||
req.setBaseProjIntro(apply.getBaseProjIntro()); | req.setBaseProjIntro(apply.getBaseProjIntro()); | ||||
req.setBaseProjStartTime(String.valueOf(apply.getBaseProjStartTime())); | |||||
req.setBaseProjEndTime(String.valueOf(apply.getBaseProjEndTime())); | |||||
req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); | |||||
req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); | |||||
req.setBaseProjSetYear(apply.getBaseProjSetYear()); | req.setBaseProjSetYear(apply.getBaseProjSetYear()); | ||||
req.setBaseProjSys(apply.getBaseProjSys()); | req.setBaseProjSys(apply.getBaseProjSys()); | ||||
req.setBaseProjSysCode(apply.getBaseDevelopCode()); | req.setBaseProjSysCode(apply.getBaseDevelopCode()); | ||||
@@ -388,8 +397,8 @@ public class ProjectConvert { | |||||
req.setBaseProjConsClass(apply.getBaseProjConsClass()); | req.setBaseProjConsClass(apply.getBaseProjConsClass()); | ||||
req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); | req.setBaseProjDuration(String.valueOf(apply.getBaseProjDuration())); | ||||
req.setBaseProjIntro(apply.getBaseProjIntro()); | req.setBaseProjIntro(apply.getBaseProjIntro()); | ||||
req.setBaseProjStartTime(String.valueOf(apply.getBaseProjStartTime())); | |||||
req.setBaseProjEndTime(String.valueOf(apply.getBaseProjEndTime())); | |||||
req.setBaseProjStartTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjStartTime())); | |||||
req.setBaseProjEndTime(ProjectCollectionUtil.convertLocalDateTime(apply.getBaseProjEndTime())); | |||||
req.setBaseProjSetYear(apply.getBaseProjSetYear()); | req.setBaseProjSetYear(apply.getBaseProjSetYear()); | ||||
req.setBaseProjSys(apply.getBaseProjSys()); | req.setBaseProjSys(apply.getBaseProjSys()); | ||||
req.setBaseProjSysCode(apply.getBaseDevelopCode()); | req.setBaseProjSysCode(apply.getBaseDevelopCode()); | ||||
@@ -50,7 +50,11 @@ import java.io.File; | |||||
import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
import java.io.IOException; | import java.io.IOException; | ||||
import java.lang.reflect.Field; | import java.lang.reflect.Field; | ||||
import java.time.LocalDate; | |||||
import java.time.LocalDateTime; | import java.time.LocalDateTime; | ||||
import java.time.format.DateTimeFormatter; | |||||
import java.time.temporal.ChronoUnit; | |||||
import java.time.temporal.Temporal; | |||||
import java.util.*; | import java.util.*; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
@@ -440,6 +444,11 @@ public class GovProjectCollectionManage { | |||||
}else{ | }else{ | ||||
saveApply.setTongTime(LocalDateTime.now()); | saveApply.setTongTime(LocalDateTime.now()); | ||||
} | } | ||||
if(Objects.nonNull(saveApply.getBaseProjStartTime()) && | |||||
Objects.nonNull(saveApply.getBaseProjEndTime())){ | |||||
saveApply.setBaseProjDuration(convertMonth(saveApply.getBaseProjStartTime(), | |||||
saveApply.getBaseProjEndTime())); | |||||
} | |||||
saveApply.setAreaCode(RegionConst.RC_LS); | saveApply.setAreaCode(RegionConst.RC_LS); | ||||
saveApply.setBizTime(LocalDateTime.now()); | saveApply.setBizTime(LocalDateTime.now()); | ||||
saveApply.setUpdateBy(user.getUsername()); | saveApply.setUpdateBy(user.getUsername()); | ||||
@@ -549,7 +558,7 @@ public class GovProjectCollectionManage { | |||||
for(GovBizProjectProcureDTO procure : procures){ | for(GovBizProjectProcureDTO procure : procures){ | ||||
procure.setBaseProjId(finalBaseProjId); | procure.setBaseProjId(finalBaseProjId); | ||||
procure.setBaseProjName(baseProjName); | procure.setBaseProjName(baseProjName); | ||||
procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + index); | |||||
procure.setBaseBidCode(finalBaseProjId + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,index)); | |||||
GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); | GovBizProjectProcure saveProcure = BeanUtil.copyProperties(procure,GovBizProjectProcure.class); | ||||
saveProcure.setBaseProjId(finalBaseProjId); | saveProcure.setBaseProjId(finalBaseProjId); | ||||
saveProcure.setId(null); | saveProcure.setId(null); | ||||
@@ -577,6 +586,22 @@ public class GovProjectCollectionManage { | |||||
} | } | ||||
/** | /** | ||||
* 计算2个时间的月份 | |||||
* @param baseProjStartTime | |||||
* @param baseProjEndTime | |||||
* @return | |||||
*/ | |||||
public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { | |||||
String start = baseProjStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | |||||
String end = baseProjEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | |||||
Temporal temporal1 = LocalDate.parse(start); | |||||
Temporal temporal2 = LocalDate.parse(end); | |||||
// 方法返回为相差月份 | |||||
Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); | |||||
return ll.toString(); | |||||
} | |||||
/** | |||||
* 暂存草稿箱 | * 暂存草稿箱 | ||||
* @param saveDTO | * @param saveDTO | ||||
* @param user | * @param user | ||||
@@ -76,7 +76,7 @@ public class GovBizProjectApply implements Serializable { | |||||
private LocalDateTime baseProjEndTime; | private LocalDateTime baseProjEndTime; | ||||
@ApiModelProperty("项目期限") | @ApiModelProperty("项目期限") | ||||
private LocalDateTime baseProjDuration; | |||||
private String baseProjDuration; | |||||
@ApiModelProperty("项目年度") | @ApiModelProperty("项目年度") | ||||
private String baseProjSetYear; | private String baseProjSetYear; | ||||
@@ -71,7 +71,7 @@ public class GovBizProjectApplyVO implements Serializable { | |||||
private LocalDateTime baseProjEndTime; | private LocalDateTime baseProjEndTime; | ||||
@ApiModelProperty("项目期限") | @ApiModelProperty("项目期限") | ||||
private LocalDateTime baseProjDuration; | |||||
private String baseProjDuration; | |||||
@ApiModelProperty("项目年度") | @ApiModelProperty("项目年度") | ||||
private String baseProjSetYear; | private String baseProjSetYear; | ||||
@@ -0,0 +1,25 @@ | |||||
package com.ningdatech.pmapi.gov.utils; | |||||
import com.ningdatech.pmapi.common.constant.CommonConst; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import java.time.LocalDateTime; | |||||
import java.time.format.DateTimeFormatter; | |||||
import java.util.Objects; | |||||
/** | |||||
* @Classname ProjectCollectionUtil | |||||
* @Description | |||||
* @Date 2023/9/14 9:07 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
public class ProjectCollectionUtil { | |||||
public static String convertLocalDateTime(LocalDateTime localDateTime){ | |||||
if(Objects.isNull(localDateTime)){ | |||||
return StringUtils.EMPTY; | |||||
} | |||||
return localDateTime.format(DateTimeFormatter.ofPattern(CommonConst.NORMAL_TIME_PATTERN)); | |||||
} | |||||
} |
@@ -5,6 +5,7 @@ import com.ningdatech.pmapi.irs.model.dto.ForwardDTO; | |||||
import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; | import com.ningdatech.pmapi.projectdeclared.manage.IrsManage; | ||||
import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.IrsApplicationVO; | ||||
import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; | import com.ningdatech.pmapi.projectdeclared.model.vo.PiotTasksVO; | ||||
import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; | |||||
import io.swagger.annotations.Api; | import io.swagger.annotations.Api; | ||||
import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
import lombok.RequiredArgsConstructor; | import lombok.RequiredArgsConstructor; | ||||
@@ -16,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestParam; | |||||
import org.springframework.web.bind.annotation.RestController; | import org.springframework.web.bind.annotation.RestController; | ||||
import java.io.UnsupportedEncodingException; | import java.io.UnsupportedEncodingException; | ||||
import java.net.UnknownHostException; | |||||
import java.security.NoSuchAlgorithmException; | import java.security.NoSuchAlgorithmException; | ||||
import java.util.List; | import java.util.List; | ||||
@@ -35,6 +37,8 @@ public class IrsController { | |||||
private final IrsManage irsManage; | private final IrsManage irsManage; | ||||
private final SynProjectCoreBizTask projectCoreBizTask; | |||||
@ApiOperation(value = "irs应用列表", notes = "irs应用列表") | @ApiOperation(value = "irs应用列表", notes = "irs应用列表") | ||||
@WebLog("irs应用列表") | @WebLog("irs应用列表") | ||||
@GetMapping("/application-list") | @GetMapping("/application-list") | ||||
@@ -54,4 +58,10 @@ public class IrsController { | |||||
public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { | public String getCreditCode() throws NoSuchAlgorithmException, UnsupportedEncodingException { | ||||
return irsManage.getCreditCode(); | return irsManage.getCreditCode(); | ||||
} | } | ||||
@ApiOperation(value = "强制刷新核心业务", notes = "强制刷新核心业务") | |||||
@GetMapping("/refresh-core-biz") | |||||
public void refreshCoreBiz(@RequestParam(required = false) String orgCode) throws UnknownHostException { | |||||
projectCoreBizTask.doTask(orgCode); | |||||
} | |||||
} | } |
@@ -80,7 +80,7 @@ public class ProjectIrsManage { | |||||
ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class); | ResponseEntity<JSONObject> forEntity = restTemplate.getForEntity(url, JSONObject.class); | ||||
JSONObject body = forEntity.getBody(); | JSONObject body = forEntity.getBody(); | ||||
log.info("core biz :{}",body); | |||||
JSONObject datas = body.getJSONObject("datas"); | JSONObject datas = body.getJSONObject("datas"); | ||||
if(Objects.nonNull(datas)){ | if(Objects.nonNull(datas)){ | ||||
return datas; | return datas; | ||||
@@ -0,0 +1,16 @@ | |||||
package com.ningdatech.pmapi.irs.mapper; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; | |||||
/** | |||||
* <p> | |||||
* Mapper 接口 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-09-13 | |||||
*/ | |||||
public interface ProjectCoreBizMapper extends BaseMapper<ProjectCoreBiz> { | |||||
} |
@@ -0,0 +1,52 @@ | |||||
package com.ningdatech.pmapi.irs.model.entity; | |||||
import com.baomidou.mybatisplus.annotation.IdType; | |||||
import com.baomidou.mybatisplus.annotation.TableId; | |||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import io.swagger.annotations.ApiModel; | |||||
import io.swagger.annotations.ApiModelProperty; | |||||
import lombok.Data; | |||||
import java.time.LocalDateTime; | |||||
/** | |||||
* @Classname ProjectCoreBiz | |||||
* @Description | |||||
* @Date 2023/9/13 15:33 | |||||
* @Author PoffyZhang | |||||
*/ | |||||
@Data | |||||
@TableName("nd_project_core_biz") | |||||
@ApiModel(value = "项目核心业务对象") | |||||
public class ProjectCoreBiz { | |||||
@TableId(type = IdType.AUTO) | |||||
@ApiModelProperty("主键") | |||||
private Long id; | |||||
@ApiModelProperty("创建时间") | |||||
private LocalDateTime createOn; | |||||
@ApiModelProperty("修改时间") | |||||
private LocalDateTime updateOn; | |||||
@ApiModelProperty("irs那边的ID") | |||||
private Long irsId; | |||||
@ApiModelProperty("生成的业务编号") | |||||
private String matterCode; | |||||
@ApiModelProperty("业务名") | |||||
private String matterName; | |||||
@ApiModelProperty("企业名") | |||||
private String orgName; | |||||
@ApiModelProperty("企业钉code") | |||||
private String orgCode; | |||||
@ApiModelProperty("区域名") | |||||
private String areaName; | |||||
@ApiModelProperty("状态") | |||||
private String userState; | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.irs.service; | |||||
import com.baomidou.mybatisplus.extension.service.IService; | |||||
import com.ningdatech.pmapi.gov.entity.BelongOrg; | |||||
import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; | |||||
import java.util.Collection; | |||||
import java.util.List; | |||||
/** | |||||
* <p> | |||||
* 服务类 | |||||
* </p> | |||||
* | |||||
* @author Zpf | |||||
* @since 2023-09-13 | |||||
*/ | |||||
public interface IProjectCoreBizService extends IService<ProjectCoreBiz> { | |||||
} |
@@ -0,0 +1,21 @@ | |||||
package com.ningdatech.pmapi.irs.service.impl; | |||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |||||
import com.ningdatech.pmapi.irs.mapper.ProjectCoreBizMapper; | |||||
import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; | |||||
import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; | |||||
import org.springframework.stereotype.Service; | |||||
/** | |||||
* <p> | |||||
* 服务实现类 | |||||
* </p> | |||||
* | |||||
* @author zpf | |||||
* @since 2023-09-13 | |||||
*/ | |||||
@Service | |||||
public class ProjectCoreBizServiceImpl extends ServiceImpl<ProjectCoreBizMapper, ProjectCoreBiz> | |||||
implements IProjectCoreBizService { | |||||
} |
@@ -55,4 +55,5 @@ public class DingOrganization implements Serializable { | |||||
private String status; | private String status; | ||||
private String unifiedSocialCreditCode; | |||||
} | } |
@@ -36,6 +36,6 @@ public class OrganizationTreeVO { | |||||
// @ApiModelProperty(value = "是否为叶子节点") | // @ApiModelProperty(value = "是否为叶子节点") | ||||
// private Boolean isLeaf; | // private Boolean isLeaf; | ||||
// | // | ||||
// @ApiModelProperty(value = "联合唯一字段方便页面使用(name##organizationCode)") | |||||
// private String unionCode; | |||||
@ApiModelProperty(value = "社会同一信用代码") | |||||
private String unifiedSocialCreditCode;; | |||||
} | } |
@@ -35,4 +35,6 @@ public class ResOrganizationListVO { | |||||
@ApiModelProperty("是否为上级条线主管单位") | @ApiModelProperty("是否为上级条线主管单位") | ||||
private Boolean isSuperiorLineCompetentUnit; | private Boolean isSuperiorLineCompetentUnit; | ||||
@ApiModelProperty("社会统一信用代码") | |||||
private String unifiedSocialCreditCode; | |||||
} | } |
@@ -13,4 +13,5 @@ public interface ProjectCodeContant { | |||||
String PROJECT_TYPE_PREFIX = "0"; | String PROJECT_TYPE_PREFIX = "0"; | ||||
String SHUZI_5 = "%05d"; | String SHUZI_5 = "%05d"; | ||||
String SHUZI_4 = "%04d"; | |||||
} | } |
@@ -22,6 +22,8 @@ import com.ningdatech.pmapi.common.helper.UserInfoHelper; | |||||
import com.ningdatech.pmapi.common.util.ExcelDownUtil; | import com.ningdatech.pmapi.common.util.ExcelDownUtil; | ||||
import com.ningdatech.pmapi.common.util.ExcelExportStyle; | import com.ningdatech.pmapi.common.util.ExcelExportStyle; | ||||
import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; | import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; | ||||
import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; | |||||
import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; | |||||
import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; | import com.ningdatech.pmapi.projectdeclared.contants.DeclaredProjectContant; | ||||
import com.ningdatech.pmapi.projectdeclared.model.dto.*; | import com.ningdatech.pmapi.projectdeclared.model.dto.*; | ||||
import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; | import com.ningdatech.pmapi.projectdeclared.model.entity.ProjectDraft; | ||||
@@ -96,6 +98,8 @@ public class DeclaredProjectManage { | |||||
private final ProjectIrsManage projectIrsManage; | private final ProjectIrsManage projectIrsManage; | ||||
private final IProjectCoreBizService coreBizService; | |||||
@Value("${spring.profiles.active}") | @Value("${spring.profiles.active}") | ||||
private String active; | private String active; | ||||
@@ -460,6 +464,10 @@ public class DeclaredProjectManage { | |||||
}else if(BizConst.PRE.equals(active) || | }else if(BizConst.PRE.equals(active) || | ||||
BizConst.PROD.equals(active)){ | BizConst.PROD.equals(active)){ | ||||
jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); | jsonObject = projectIrsManage.searchCoreBiz(businessName,user.getEmpPosUnitCode(),limit,page); | ||||
// List<ProjectCoreBiz> list = coreBizService.list(Wrappers.lambdaQuery(ProjectCoreBiz.class) | |||||
// .eq(ProjectCoreBiz::getOrgCode, user.getEmpPosUnitCode()) | |||||
// .like(StringUtils.isNotBlank(businessName), ProjectCoreBiz::getMatterName, businessName)); | |||||
// jsonObject.put("data",list); | |||||
} | } | ||||
return jsonObject; | return jsonObject; | ||||
} | } | ||||
@@ -135,6 +135,43 @@ public class SynProjectCollectionTask { | |||||
log.info("项目归集库存转换PDF任务结束====={}s",stopWatch.getTotalTimeSeconds()); | log.info("项目归集库存转换PDF任务结束====={}s",stopWatch.getTotalTimeSeconds()); | ||||
} | } | ||||
public void stagingConvertPdf2(String projId) { | |||||
log.info("项目归集库存转换PDF任务2开始====="); | |||||
StopWatch stopWatch = new StopWatch(); | |||||
stopWatch.start(); | |||||
ProjectListReq req = new ProjectListReq(); | |||||
req.setPageNumber(1); | |||||
req.setPageSize(BizConst.MAX_EXPORT_COUNT); | |||||
List<GovBizProjectApprove> projects = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.eq(GovBizProjectApprove::getDeleted,Boolean.FALSE) | |||||
.eq(StringUtils.isNotBlank(projId),GovBizProjectApprove::getBaseProjId,projId) | |||||
.isNotNull(GovBizProjectApprove::getApprovalFile) | |||||
.isNull(GovBizProjectApprove::getApprovalFilePdf)); | |||||
if(CollUtil.isEmpty(projects)){ | |||||
log.info("没有项目归集 任务终止"); | |||||
return; | |||||
} | |||||
for(GovBizProjectApprove project : projects){ | |||||
String baseProjId = project.getBaseProjId(); | |||||
//开始转换PDF | |||||
GovBizProjectApprove approve = approveService.getOne(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.eq(GovBizProjectApprove::getBaseProjId,baseProjId) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.isNull(approve)){ | |||||
return; | |||||
} | |||||
if(StringUtils.isBlank(approve.getApprovalFilePdf()) && StringUtils.isNotBlank(approve.getApprovalFile())){ | |||||
StringJoiner sj = collectionManage.convertAndUpload(approve.getApprovalFile()); | |||||
approve.setApprovalFilePdf(sj.toString()); | |||||
} | |||||
} | |||||
stopWatch.stop(); | |||||
log.info("项目归集库存转换PDF任务2结束====={}s",stopWatch.getTotalTimeSeconds()); | |||||
} | |||||
//开始转换PDF | //开始转换PDF | ||||
private void convertPdfVo(String baseProjId) { | private void convertPdfVo(String baseProjId) { | ||||
convertPdfApply(baseProjId); | convertPdfApply(baseProjId); | ||||
@@ -0,0 +1,173 @@ | |||||
package com.ningdatech.pmapi.scheduler.task; | |||||
import cn.hutool.core.collection.CollUtil; | |||||
import cn.hutool.core.date.StopWatch; | |||||
import com.alibaba.fastjson.JSON; | |||||
import com.alibaba.fastjson.JSONArray; | |||||
import com.alibaba.fastjson.JSONObject; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.google.common.collect.Lists; | |||||
import com.ningdatech.basic.model.GenericResult; | |||||
import com.ningdatech.pmapi.common.constant.BizConst; | |||||
import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; | |||||
import com.ningdatech.pmapi.irs.manage.ProjectIrsManage; | |||||
import com.ningdatech.pmapi.irs.model.entity.ProjectCoreBiz; | |||||
import com.ningdatech.pmapi.irs.service.IProjectCoreBizService; | |||||
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; | |||||
import com.ningdatech.pmapi.organization.service.IDingOrganizationService; | |||||
import com.ningdatech.pmapi.projectdeclared.contants.ProjectCodeContant; | |||||
import com.ningdatech.zwdd.client.ZwddClient; | |||||
import com.ningdatech.zwdd.model.dto.DingOrgInfoDTO; | |||||
import lombok.RequiredArgsConstructor; | |||||
import lombok.extern.slf4j.Slf4j; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.springframework.beans.factory.annotation.Autowired; | |||||
import org.springframework.beans.factory.annotation.Value; | |||||
import org.springframework.scheduling.annotation.Scheduled; | |||||
import org.springframework.stereotype.Component; | |||||
import java.net.InetAddress; | |||||
import java.net.UnknownHostException; | |||||
import java.time.LocalDateTime; | |||||
import java.util.List; | |||||
import java.util.Objects; | |||||
/** | |||||
* @author ZPF | |||||
* @since 2023/09/13 18:16 | |||||
*/ | |||||
@Component | |||||
@Slf4j | |||||
@RequiredArgsConstructor | |||||
public class SynProjectCoreBizTask { | |||||
@Value("${hostname}") | |||||
public String HOST; | |||||
@Value("${spring.profiles.active}") | |||||
public String active; | |||||
@Autowired | |||||
private IProjectCoreBizService projectCoreBizService; | |||||
@Autowired | |||||
private IDingOrganizationService organizationService; | |||||
@Autowired | |||||
private ZwddClient zwddClient; | |||||
@Autowired | |||||
private ProjectIrsManage projectIrsManage; | |||||
/** | |||||
* 前置机每天晚上10点自动清空,第二天早上6点获取数据 | |||||
* 定时同步前置机数据 每天1点开始执行一次 | |||||
* | |||||
*/ | |||||
@Scheduled(cron = "0 0 2 * * ?") | |||||
public void doTask() throws UnknownHostException { | |||||
if (!HOST.equals(InetAddress.getLocalHost().getHostName())) { | |||||
log.info("定时器没开启或者host不对! {}:{}", | |||||
HOST,InetAddress.getLocalHost().getHostName()); | |||||
return; | |||||
} | |||||
log.info("同步项目核心业务开始====="); | |||||
StopWatch stopWatch = new StopWatch(); | |||||
stopWatch.start(); | |||||
List<DingOrganization> orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | |||||
.in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE | |||||
, DingOrganizationContant.GOV_TEMPORARY))); | |||||
log.info("总共需要同步 orgs size :{}",orgs.size()); | |||||
syncCoreBiz(orgs); | |||||
stopWatch.stop(); | |||||
log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); | |||||
} | |||||
public void doTask(String orgCode) throws UnknownHostException { | |||||
log.info("同步项目核心业务开始====="); | |||||
StopWatch stopWatch = new StopWatch(); | |||||
stopWatch.start(); | |||||
List<DingOrganization> orgs = organizationService.list(Wrappers.lambdaQuery(DingOrganization.class) | |||||
.in(DingOrganization::getTypeCode, Lists.newArrayList(DingOrganizationContant.UNIT_TYPE | |||||
, DingOrganizationContant.GOV_TEMPORARY)) | |||||
.eq(StringUtils.isNotBlank(orgCode),DingOrganization::getOrganizationCode,orgCode)); | |||||
log.info("总共需要同步 orgs size :{}",orgs.size()); | |||||
syncCoreBiz(orgs); | |||||
stopWatch.stop(); | |||||
log.info("同步项目核心业务结束====={}s",stopWatch.getTotalTimeSeconds()); | |||||
} | |||||
private void syncCoreBiz(List<DingOrganization> orgs) { | |||||
for(DingOrganization organization : orgs){ | |||||
GenericResult<DingOrgInfoDTO> dingResult = zwddClient.getOrganizationByCode(organization.getOrganizationCode()); | |||||
log.info("core biz result : {}",JSON.toJSONString(dingResult)); | |||||
if(dingResult.isSuccess()){ | |||||
DingOrgInfoDTO data = dingResult.getData(); | |||||
String unifiedSocialCreditCode = data.getUnifiedSocialCreditCode(); | |||||
if(StringUtils.isNotBlank(unifiedSocialCreditCode)){ | |||||
organization.setUnifiedSocialCreditCode(unifiedSocialCreditCode); | |||||
organizationService.updateById(organization); | |||||
} | |||||
//去请求IRS接口 | |||||
JSONObject jsonObject = projectIrsManage.searchCoreBiz(null, organization.getOrganizationCode(), 1000, 1); | |||||
JSONArray jsonArray = jsonObject.getJSONArray(BizConst.RESPONSE_KEY_DATA); | |||||
if(CollUtil.isNotEmpty(jsonArray)){ | |||||
jsonArray.forEach(j -> { | |||||
JSONObject jsonData = JSON.parseObject(JSON.toJSONString(j)); | |||||
ProjectCoreBiz coreBiz = new ProjectCoreBiz(); | |||||
// | |||||
Long irsId = jsonData.getLong(BizConst.RESPONSE_KEY_ID); | |||||
String dingCode = jsonData.getString(BizConst.RESPONSE_KEY_DING_CODE); | |||||
String matterName = jsonData.getString(BizConst.RESPONSE_KEY_MATTER_NAME); | |||||
String orgName = jsonData.getString(BizConst.RESPONSE_KEY_ORG_NAME); | |||||
String userState = jsonData.getString(BizConst.RESPONSE_KEY_USER_STATE); | |||||
String areaName = jsonData.getString(BizConst.RESPONSE_KEY_AREA_NAME); | |||||
ProjectCoreBiz old = projectCoreBizService.getOne(Wrappers.lambdaQuery(ProjectCoreBiz.class) | |||||
.eq(ProjectCoreBiz::getIrsId, irsId) | |||||
.last(BizConst.LIMIT_1)); | |||||
if(Objects.nonNull(old)){ | |||||
coreBiz.setId(old.getId()); | |||||
}else{ | |||||
coreBiz.setCreateOn(LocalDateTime.now()); | |||||
} | |||||
coreBiz.setUpdateOn(LocalDateTime.now()); | |||||
coreBiz.setIrsId(irsId); | |||||
coreBiz.setMatterName(matterName); | |||||
coreBiz.setOrgCode(dingCode); | |||||
coreBiz.setOrgName(orgName); | |||||
coreBiz.setUserState(userState); | |||||
coreBiz.setAreaName(areaName); | |||||
coreBiz.setMatterCode(irsId.toString()); | |||||
projectCoreBizService.saveOrUpdate(coreBiz); | |||||
coreBiz.setMatterCode(genirate(unifiedSocialCreditCode,coreBiz.getId())); | |||||
projectCoreBizService.updateById(coreBiz); | |||||
}); | |||||
} | |||||
} | |||||
} | |||||
} | |||||
/** | |||||
* 生成 编号 | |||||
* @param unifiedSocialCreditCode | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
private String genirate(String unifiedSocialCreditCode, Long id) { | |||||
String formatId = String.format(ProjectCodeContant.SHUZI_4, id); | |||||
return unifiedSocialCreditCode + formatId; | |||||
} | |||||
} |
@@ -1,8 +1,15 @@ | |||||
package com.ningdatech.pmapi.projectCollection; | package com.ningdatech.pmapi.projectCollection; | ||||
import cn.hutool.core.bean.BeanUtil; | import cn.hutool.core.bean.BeanUtil; | ||||
import cn.hutool.core.collection.CollUtil; | |||||
import com.alibaba.fastjson.JSON; | |||||
import com.alibaba.fastjson.JSONArray; | |||||
import com.alibaba.fastjson.JSONObject; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.google.common.collect.Lists; | import com.google.common.collect.Lists; | ||||
import com.ningdatech.basic.util.StrPool; | |||||
import com.ningdatech.log.model.domain.OptLog; | |||||
import com.ningdatech.log.service.OptLogService; | |||||
import com.ningdatech.pmapi.AppTests; | import com.ningdatech.pmapi.AppTests; | ||||
import com.ningdatech.pmapi.common.constant.BizConst; | import com.ningdatech.pmapi.common.constant.BizConst; | ||||
import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; | import com.ningdatech.pmapi.gov.model.dto.GovBizProjectApplyDTO; | ||||
@@ -12,12 +19,21 @@ import com.ningdatech.pmapi.gov.model.entity.*; | |||||
import com.ningdatech.pmapi.gov.service.*; | import com.ningdatech.pmapi.gov.service.*; | ||||
import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | import com.ningdatech.pmapi.projectdeclared.utils.GenerateProjectCodeUtil; | ||||
import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; | import com.ningdatech.pmapi.scheduler.task.SynProjectCollectionTask; | ||||
import com.ningdatech.pmapi.scheduler.task.SynProjectCoreBizTask; | |||||
import org.apache.commons.lang3.StringUtils; | |||||
import org.junit.Test; | import org.junit.Test; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import java.net.UnknownHostException; | import java.net.UnknownHostException; | ||||
import java.time.LocalDate; | |||||
import java.time.LocalDateTime; | |||||
import java.time.format.DateTimeFormatter; | |||||
import java.time.temporal.ChronoUnit; | |||||
import java.time.temporal.Temporal; | |||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Objects; | |||||
import java.util.StringJoiner; | |||||
/** | /** | ||||
* @Classname ProjectCollectionTest | * @Classname ProjectCollectionTest | ||||
@@ -51,6 +67,12 @@ public class ProjectCollectionTest extends AppTests { | |||||
@Autowired | @Autowired | ||||
private SynProjectCollectionTask collectionTask; | private SynProjectCollectionTask collectionTask; | ||||
@Autowired | |||||
private OptLogService optLogService; | |||||
@Autowired | |||||
private SynProjectCoreBizTask projectCoreBizTask; | |||||
@Test | @Test | ||||
public void test(){ | public void test(){ | ||||
List<String> baseProjIds = Lists.newArrayList("33110000020230100061"); | List<String> baseProjIds = Lists.newArrayList("33110000020230100061"); | ||||
@@ -95,4 +117,100 @@ public class ProjectCollectionTest extends AppTests { | |||||
public void test3() throws UnknownHostException { | public void test3() throws UnknownHostException { | ||||
collectionTask.stagingConvertPdf("33112200020230100008"); | collectionTask.stagingConvertPdf("33112200020230100008"); | ||||
} | } | ||||
/** | |||||
* 去补文件 | |||||
*/ | |||||
@Test | |||||
public void test4(){ | |||||
List<GovBizProjectApprove> approves = approveService.list(Wrappers.lambdaQuery(GovBizProjectApprove.class) | |||||
.eq(GovBizProjectApprove::getApprovalFile,"null")); | |||||
System.out.println("approves size :" + approves.size()); | |||||
for(GovBizProjectApprove approve : approves){ | |||||
//https://sjxmglxt-oss.oss-cn-hangzhou-zjzwy01-d01-a.cloud-inner.zj.gov.cn/20230912/6a5c00def2db41b199d8cc99ff04728e.pdf | |||||
String baseProjId = approve.getBaseProjId(); | |||||
List<OptLog> opLogs = optLogService.list(Wrappers.lambdaQuery(OptLog.class) | |||||
.like(OptLog::getParams, approve.getBaseProjName()) | |||||
.like(OptLog::getParams, "\"approvalFile\"") | |||||
.last(BizConst.LIMIT_1)); | |||||
if(CollUtil.isEmpty(opLogs)){ | |||||
System.out.println("没有这个记录"); | |||||
continue; | |||||
} | |||||
for(OptLog opLog : opLogs){ | |||||
System.out.println(opLog.getParams()); | |||||
if(StringUtils.isNotBlank(opLog.getParams())){ | |||||
StringJoiner sj = new StringJoiner(";"); | |||||
JSONArray jsonArray = JSON.parseArray(opLog.getParams()); | |||||
jsonArray.forEach(j -> { | |||||
JSONObject json = JSON.parseObject(JSON.toJSONString(j)); | |||||
JSONObject approveJson = json.getJSONObject("approve"); | |||||
if(Objects.nonNull(approveJson)){ | |||||
String approvalFile = approveJson.getString("approvalFile"); | |||||
System.out.println("approvalFile:" + approvalFile); | |||||
if(StringUtils.isBlank(approvalFile) || "null".equals(approvalFile)){ | |||||
return; | |||||
} | |||||
sj.add(approvalFile); | |||||
} | |||||
}); | |||||
if(StringUtils.isNotBlank(sj.toString())){ | |||||
approve.setApprovalFile(sj.toString()); | |||||
approveService.updateById(approve); | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
} | |||||
} | |||||
@Test | |||||
public void test5(){ | |||||
List<GovBizProjectApply> list = applyService.list(Wrappers.lambdaQuery(GovBizProjectApply.class) | |||||
.isNotNull(GovBizProjectApply::getBaseProjStartTime) | |||||
.isNotNull(GovBizProjectApply::getBaseProjEndTime) | |||||
.isNull(GovBizProjectApply::getBaseProjDuration)); | |||||
for(GovBizProjectApply apply : list){ | |||||
apply.setBaseProjDuration(convertMonth(apply.getBaseProjStartTime(),apply.getBaseProjEndTime())); | |||||
applyService.updateById(apply); | |||||
} | |||||
} | |||||
public static String convertMonth(LocalDateTime baseProjStartTime, LocalDateTime baseProjEndTime) { | |||||
String start = baseProjStartTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | |||||
String end = baseProjEndTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | |||||
Temporal temporal1 = LocalDate.parse(start); | |||||
Temporal temporal2 = LocalDate.parse(end); | |||||
// 方法返回为相差月份 | |||||
Long ll = ChronoUnit.MONTHS.between(temporal1, temporal2); | |||||
return ll.toString(); | |||||
} | |||||
@Test | |||||
public void test6(){ | |||||
List<GovBizProjectProcure> list = procureService.list(Wrappers.lambdaQuery(GovBizProjectProcure.class) | |||||
.eq(GovBizProjectProcure::getDeleted,Boolean.FALSE)); | |||||
for(GovBizProjectProcure procure : list){ | |||||
try{ | |||||
String index = procure.getBaseBidCode().split("-")[1]; | |||||
procure.setBaseBidCode(procure.getBaseProjId() + StrPool.DASH + String.format(StrPool.FORMAT_DATE_SINGLE_DIGITS,Integer.parseInt(index))); | |||||
procureService.updateById(procure); | |||||
}catch (Exception e){ | |||||
e.printStackTrace(); | |||||
} | |||||
} | |||||
} | |||||
@Test | |||||
public void test7() throws UnknownHostException { | |||||
String orgCode = "GO_5f1f6f28a6f7484ea3b9991d8d02599f"; | |||||
projectCoreBizTask.doTask(orgCode); | |||||
} | |||||
} | } |