diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java index 05d9b69..160dcd6 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/expert/helper/ExpertManageHelper.java @@ -65,7 +65,7 @@ public class ExpertManageHelper { tagFieldInfoList.addAll(goodAt); tagFieldInfoList.addAll(technicalExpertise); tagFieldInfoList.addAll(industrySector); - if(CollUtil.isNotEmpty(expertSource)){ + if (CollUtil.isNotEmpty(expertSource)) { tagFieldInfoList.addAll(expertSource); } for (TagFieldInfo tagFieldInfo : tagFieldInfoList) { diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java index d4daccc..62fd115 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/controller/CompanyFiscalCodeController.java @@ -3,6 +3,7 @@ package com.ningdatech.pmapi.fiscal.controller; import com.ningdatech.pmapi.fiscal.manage.CompanyFiscalCodeManage; import com.ningdatech.pmapi.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; +import com.ningdatech.pmapi.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; @@ -34,4 +35,10 @@ public class CompanyFiscalCodeController { companyFiscalCodeManage.fiscalCodeConfigure(reqCompanyFiscalCodeAndSealSnPO); } + @ApiOperation(value = "获取财政编码/配置", notes = "获取财政编码配置") + @PostMapping("/fiscal-and-seal/get-configure/") + public void getFiscalAndSealCodeConfigure(@Valid @RequestBody ReqGetCompanyFiscalCodeAndSealSnPO request) { + companyFiscalCodeManage.getFiscalCodeConfigure(request); + } + } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java index b6fe709..386b74c 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/manage/CompanyFiscalCodeManage.java @@ -3,14 +3,18 @@ package com.ningdatech.pmapi.fiscal.manage; import com.ningdatech.pmapi.common.helper.UserInfoHelper; import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; import com.ningdatech.pmapi.fiscal.model.po.ReqCompanyFiscalCodeAndSealSnPO; +import com.ningdatech.pmapi.fiscal.model.po.ReqGetCompanyFiscalCodeAndSealSnPO; +import com.ningdatech.pmapi.fiscal.model.vo.ResCompanyFiscalCodeAndSealSnVO; import com.ningdatech.pmapi.fiscal.service.ICompanyFiscalCodeService; import com.ningdatech.pmapi.signature.entity.CompanySignature; import com.ningdatech.pmapi.signature.service.ICompanySignatureService; import com.ningdatech.pmapi.user.util.LoginUserUtil; import lombok.RequiredArgsConstructor; +import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import java.time.LocalDateTime; +import java.util.Objects; /** * @author liuxinxin @@ -28,29 +32,60 @@ public class CompanyFiscalCodeManage { public void fiscalCodeConfigure(ReqCompanyFiscalCodeAndSealSnPO reqCompanyFiscalCodeAndSealSnPO) { Long userId = LoginUserUtil.getUserId(); - String organizationCode = userInfoHelper.getOrganizationCode(userId); + + String organizationCode = reqCompanyFiscalCodeAndSealSnPO.getOrganizationCode(); + if (StringUtils.isBlank(organizationCode)) { + organizationCode = userInfoHelper.getOrganizationCode(userId); + } // TODO 校验用户权限 // 保存财政编码配置 + CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); + if (Objects.isNull(companyFiscalCode)) { + companyFiscalCode = new CompanyFiscalCode(); + companyFiscalCode.setOrganizationCode(organizationCode); + companyFiscalCode.setCreateOn(LocalDateTime.now()); + companyFiscalCode.setCreateBy(userId); + } String fiscalCode = reqCompanyFiscalCodeAndSealSnPO.getFiscalCode(); - CompanyFiscalCode companyFiscalCodeSaveRecord = new CompanyFiscalCode(); - companyFiscalCodeSaveRecord.setFiscalCode(fiscalCode); - companyFiscalCodeSaveRecord.setOrganizationCode(organizationCode); - companyFiscalCodeSaveRecord.setCreateOn(LocalDateTime.now()); - companyFiscalCodeSaveRecord.setUpdateOn(LocalDateTime.now()); - companyFiscalCodeSaveRecord.setCreateBy(userId); - companyFiscalCodeSaveRecord.setUpdateBy(userId); - iCompanyFiscalCodeService.save(companyFiscalCodeSaveRecord); + companyFiscalCode.setFiscalCode(fiscalCode); + companyFiscalCode.setUpdateOn(LocalDateTime.now()); + companyFiscalCode.setUpdateBy(userId); + iCompanyFiscalCodeService.save(companyFiscalCode); + // 保存印章配置 + CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); + if (Objects.isNull(companySignature)) { + companySignature = new CompanySignature(); + companySignature.setOrganizationCode(organizationCode); + companySignature.setCreateOn(LocalDateTime.now()); + } String sealSn = reqCompanyFiscalCodeAndSealSnPO.getSealSn(); - CompanySignature companySignatureSaveRecord = new CompanySignature(); - companySignatureSaveRecord.setSealSn(sealSn); - companySignatureSaveRecord.setOrganizationCode(organizationCode); - companySignatureSaveRecord.setCreateOn(LocalDateTime.now()); - companySignatureSaveRecord.setUpdateOn(LocalDateTime.now()); - companySignatureSaveRecord.setCreateBy(userId); - companySignatureSaveRecord.setUpdateBy(userId); - iCompanySignatureService.save(companySignatureSaveRecord); + companySignature.setSealSn(sealSn); + companySignature.setUpdateOn(LocalDateTime.now()); + companySignature.setCreateBy(userId); + companySignature.setUpdateBy(userId); + iCompanySignatureService.save(companySignature); + } + + public ResCompanyFiscalCodeAndSealSnVO getFiscalCodeConfigure(ReqGetCompanyFiscalCodeAndSealSnPO request) { + Long userId = LoginUserUtil.getUserId(); + String organizationCode = request.getOrganizationCode(); + if (StringUtils.isBlank(organizationCode)) { + organizationCode = userInfoHelper.getOrganizationCode(userId); + } + CompanySignature companySignature = iCompanySignatureService.getByOrganizationCode(organizationCode); + CompanyFiscalCode companyFiscalCode = iCompanyFiscalCodeService.getByOrganizationCode(organizationCode); + + ResCompanyFiscalCodeAndSealSnVO returnVO = new ResCompanyFiscalCodeAndSealSnVO(); + if (Objects.isNull(companySignature)) { + return null; + } + returnVO.setCreateTime(companySignature.getCreateOn()); + returnVO.setUpdateTime(companySignature.getUpdateOn()); + returnVO.setFiscalCode(companyFiscalCode.getFiscalCode()); + returnVO.setSealSn(companySignature.getSealSn()); + return returnVO; } } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java index 401e3ee..05255ae 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqCompanyFiscalCodeAndSealSnPO.java @@ -14,7 +14,7 @@ import javax.validation.constraints.NotBlank; @ApiModel("财政编码配置") public class ReqCompanyFiscalCodeAndSealSnPO { - @NotBlank(message = "组织编码 不能为空") +// @NotBlank(message = "组织编码 不能为空") @ApiModelProperty("组织编码") private String organizationCode; diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java new file mode 100644 index 0000000..bc6d313 --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/po/ReqGetCompanyFiscalCodeAndSealSnPO.java @@ -0,0 +1,18 @@ +package com.ningdatech.pmapi.fiscal.model.po; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuxinxin + * @date 2023/2/10 下午4:24 + */ +@Data +@ApiModel("获取财政编码配置") +public class ReqGetCompanyFiscalCodeAndSealSnPO { + + @ApiModelProperty("组织编码") + private String organizationCode; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java new file mode 100644 index 0000000..264d73e --- /dev/null +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/model/vo/ResCompanyFiscalCodeAndSealSnVO.java @@ -0,0 +1,33 @@ +package com.ningdatech.pmapi.fiscal.model.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author liuxinxin + * @date 2023/3/23 上午10:58 + */ + +@Data +@ApiModel("财政编码配置VO") +public class ResCompanyFiscalCodeAndSealSnVO { + + @ApiModelProperty("组织编码") + private String organizationCode; + + @ApiModelProperty("财政编码") + private String fiscalCode; + + @ApiModelProperty("印章编号") + private String sealSn; + + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + @ApiModelProperty("更新时间") + private LocalDateTime updateTime; + +} diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java index b123802..80741af 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/fiscal/service/ICompanyFiscalCodeService.java @@ -1,11 +1,11 @@ package com.ningdatech.pmapi.fiscal.service; -import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; import com.baomidou.mybatisplus.extension.service.IService; +import com.ningdatech.pmapi.fiscal.entity.CompanyFiscalCode; /** *
- * 服务类 + * 服务类 *
* * @author Lierbao @@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService; */ public interface ICompanyFiscalCodeService extends IService- * 服务实现类 + * 服务实现类 *
* * @author Lierbao * @since 2023-02-10 */ @Service + public class CompanyFiscalCodeServiceImpl extends ServiceImpl
@@ -13,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface ICompanySignatureService extends IService
- * 服务实现类
+ * 服务实现类
*