Commit 3adfc89b authored by hongguangwu's avatar hongguangwu

MVP1.7.18-法大大公司主体相关

parent 85bda354
...@@ -11,10 +11,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.FascService; ...@@ -11,10 +11,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.service.FascService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascPushLogService; import com.yifu.cloud.plus.v1.yifu.archives.service.TFascPushLogService;
import com.yifu.cloud.plus.v1.yifu.archives.utils.DoFascTask; import com.yifu.cloud.plus.v1.yifu.archives.utils.DoFascTask;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common; import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R; import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner; import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
...@@ -22,13 +20,12 @@ import lombok.RequiredArgsConstructor; ...@@ -22,13 +20,12 @@ import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.HashMap;
import java.util.Map;
/** /**
* @auther huyc * @auther huyc
...@@ -55,6 +52,30 @@ public class FascController { ...@@ -55,6 +52,30 @@ public class FascController {
private static String FASC_BIZ_CONTENT = "bizContent"; private static String FASC_BIZ_CONTENT = "bizContent";
private static String FASC_SUCCESS = "success"; private static String FASC_SUCCESS = "success";
/**
* @Description: 获取新建模板的Url
* @Author: hgw
* @Date: 2025/9/26 16:21
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "获取新建模板的Url")
@GetMapping("/getCreateNewTemplate")
public R<String> getCreateNewTemplate(@RequestParam String companyId) {
return fascService.getCreateNewTemplate(companyId);
}
/**
* @Description: 获取编辑模板的url
* @Author: hgw
* @Date: 2025/9/26 16:21
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Operation(description = "获取编辑模板的url")
@GetMapping("/getEditNewTemplate")
public R<String> getEditNewTemplate(@RequestParam String id) {
return fascService.getEditNewTemplate(id);
}
/** /**
* @Description: 获取模板 * @Description: 获取模板
* @Author: hgw * @Author: hgw
......
...@@ -34,6 +34,7 @@ import org.springframework.security.access.prepost.PreAuthorize; ...@@ -34,6 +34,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List;
/** /**
...@@ -64,6 +65,15 @@ public class TFascCompanyController { ...@@ -64,6 +65,15 @@ public class TFascCompanyController {
return new R<>(tFascCompanyService.getTFascCompanyPage(page, tFascCompany)); return new R<>(tFascCompanyService.getTFascCompanyPage(page, tFascCompany));
} }
/**
* 获取全量列表
*/
@Operation(description = "获取全量列表")
@GetMapping("/getTFascCompanyAllList")
public R<List<TFascCompany>> getTFascCompanyAllList(@RequestParam(required = false) String companyName) {
return new R<>(tFascCompanyService.getTFascCompanyAllList(companyName));
}
/** /**
* 通过id查询法大大专业版公司信息表 * 通过id查询法大大专业版公司信息表
* *
......
...@@ -38,7 +38,7 @@ public interface TFascCompanyMapper extends BaseMapper<TFascCompany> { ...@@ -38,7 +38,7 @@ public interface TFascCompanyMapper extends BaseMapper<TFascCompany> {
* 法大大专业版公司信息表简单分页查询 * 法大大专业版公司信息表简单分页查询
* @return * @return
*/ */
List<TFascCompany> getTFascCompanyAllList(); List<TFascCompany> getTFascCompanyAllList(@Param("companyName") String companyName);
IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, @Param("tFascCompany") TFascCompany tFascCompany); IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, @Param("tFascCompany") TFascCompany tFascCompany);
......
...@@ -30,9 +30,15 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R; ...@@ -30,9 +30,15 @@ import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
*/ */
public interface FascService extends IService<FddContractInfo> { public interface FascService extends IService<FddContractInfo> {
// 获取新建模板的url
R<String> getCreateNewTemplate(String companyId);
// 获取编辑模板的url(id:模板列表的id)
R<String> getEditNewTemplate(String id);
// 获取模板 // 获取模板
R<String> getTemplate(String templateName) throws ApiException; R<String> getTemplate(String templateName) throws ApiException;
// 获取模板详情预览链接 // 获取模板详情预览链接
R<String> getTemplateDetailUrl(String signTemplateId) throws ApiException; R<String> getTemplateDetailUrl(String signTemplateId) throws ApiException;
......
...@@ -36,7 +36,7 @@ public interface TFascCompanyService extends IService<TFascCompany> { ...@@ -36,7 +36,7 @@ public interface TFascCompanyService extends IService<TFascCompany> {
* *
* @return * @return
*/ */
List<TFascCompany> getTFascCompanyAllList(); List<TFascCompany> getTFascCompanyAllList(String companyName);
IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, TFascCompany tFascCompany); IPage<TFascCompany> getTFascCompanyPage(Page<TFascCompany> page, TFascCompany tFascCompany);
......
...@@ -72,6 +72,39 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -72,6 +72,39 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
private static final Logger logger = LoggerFactory.getLogger(FascService.class); private static final Logger logger = LoggerFactory.getLogger(FascService.class);
// 获取新建模板的url
@Override
public R<String> getCreateNewTemplate(String companyId) {
if (Common.isEmpty(companyId)) {
return R.failed("请传参公司ID!");
}
TFascCompany company = tFascCompanyService.getById(companyId);
if (company == null || Common.isEmpty(company.getId())) {
return R.failed("未找到公司信息,请刷新后重试!");
}
return fascUtil.getCreateNewTemplate(tFascPushLogService, company);
}
// 获取新建模板的url
@Override
public R<String> getEditNewTemplate(String id) {
if (Common.isEmpty(id)) {
return R.failed("请传参列表ID!");
}
TFascTemplate tFascTemplate = tFascTemplateService.getById(id);
if (tFascTemplate == null || Common.isEmpty(tFascTemplate.getId())) {
return R.failed("未找到模板信息,请刷新后重试!");
}
if (Common.isEmpty(tFascTemplate.getSignTemplateId()) || Common.isEmpty(tFascTemplate.getCompanyId())) {
return R.failed("模板信息缺失,请刷新后重试!");
}
TFascCompany company = tFascCompanyService.getById(tFascTemplate.getCompanyId());
if (company == null || Common.isEmpty(company.getId())) {
return R.failed("未找到公司信息,请刷新后重试!");
}
return fascUtil.getEditNewTemplate(tFascPushLogService, tFascTemplate.getSignTemplateId(), company);
}
@Override @Override
public R<String> getTemplate(String templateName) throws ApiException { public R<String> getTemplate(String templateName) throws ApiException {
...@@ -82,7 +115,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr ...@@ -82,7 +115,7 @@ public class FascServiceImpl extends ServiceImpl<FddContractInfoMapper, FddContr
userId = user.getId(); userId = user.getId();
userName = user.getNickname(); userName = user.getNickname();
} }
List<TFascCompany> companyList = tFascCompanyService.getTFascCompanyAllList(); List<TFascCompany> companyList = tFascCompanyService.getTFascCompanyAllList(null);
if (companyList != null && !companyList.isEmpty()) { if (companyList != null && !companyList.isEmpty()) {
// templateName 签署任务模板名称 // templateName 签署任务模板名称
List<TFascTemplate> tList ; List<TFascTemplate> tList ;
......
...@@ -42,8 +42,8 @@ public class TFascCompanyServiceImpl extends ServiceImpl<TFascCompanyMapper, TFa ...@@ -42,8 +42,8 @@ public class TFascCompanyServiceImpl extends ServiceImpl<TFascCompanyMapper, TFa
* @return * @return
*/ */
@Override @Override
public List<TFascCompany> getTFascCompanyAllList() { public List<TFascCompany> getTFascCompanyAllList(String companyName) {
return baseMapper.getTFascCompanyAllList(); return baseMapper.getTFascCompanyAllList(companyName);
} }
@Override @Override
......
...@@ -12,10 +12,7 @@ import com.fasc.open.api.v5_1.client.ServiceClient; ...@@ -12,10 +12,7 @@ import com.fasc.open.api.v5_1.client.ServiceClient;
import com.fasc.open.api.v5_1.client.SignTaskClient; import com.fasc.open.api.v5_1.client.SignTaskClient;
import com.fasc.open.api.v5_1.client.TemplateClient; import com.fasc.open.api.v5_1.client.TemplateClient;
import com.fasc.open.api.v5_1.req.signtask.*; import com.fasc.open.api.v5_1.req.signtask.*;
import com.fasc.open.api.v5_1.req.template.GetSignTemplateListReq; import com.fasc.open.api.v5_1.req.template.*;
import com.fasc.open.api.v5_1.req.template.GetTemplatePreviewUrlReq;
import com.fasc.open.api.v5_1.req.template.SignTemplateDetailReq;
import com.fasc.open.api.v5_1.req.template.SignTemplateListFilterInfo;
import com.fasc.open.api.v5_1.res.service.AccessTokenRes; import com.fasc.open.api.v5_1.res.service.AccessTokenRes;
import com.fasc.open.api.v5_1.res.signtask.CreateSignTaskRes; import com.fasc.open.api.v5_1.res.signtask.CreateSignTaskRes;
import com.fasc.open.api.v5_1.res.signtask.SignTaskGetFileRes; import com.fasc.open.api.v5_1.res.signtask.SignTaskGetFileRes;
...@@ -97,6 +94,92 @@ public class FascUtil { ...@@ -97,6 +94,92 @@ public class FascUtil {
return token; return token;
} }
/**
* @Description: 获取新建模板的url
* @Author: hgw
* @Date: 2025-12-11 15:06:54
**/
public R<String> getCreateNewTemplate(TFascPushLogService tFascPushLogService, TFascCompany company) {
try {
OpenApiClient openApiClient = new OpenApiClient(company.getAppId(), company.getAppSecret(), company.getAppUrl());
String accessToken = this.getFascToken(openApiClient, company);
TemplateClient templateClient = new TemplateClient(openApiClient);
GetTemplateCreateUrlReq getTemplateCreateUrlReq = new GetTemplateCreateUrlReq();
getTemplateCreateUrlReq.setOpenCorpId(company.getOpenId());
getTemplateCreateUrlReq.setType("sign");
getTemplateCreateUrlReq.setAccessToken(accessToken);
// 新增推送日志
TFascPushLog pushLog = new TFascPushLog();
pushLog.setTransReferenceId(company.getOpenId());
pushLog.setPushData(JSON.toJSONString(templateClient, features));
pushLog.setTaskStatus(CommonConstants.ZERO_STRING);
pushLog.setTypeKey("获取新建模板的url,CompanyName:" + company.getCompanyName());
pushLog.setTypeName("获取新建模板的url");
pushLog.setContractId(company.getId());
tFascPushLogService.save(pushLog);
BaseRes<GetTemplateCreateUrlRes> res = templateClient.getTemplateCreateUrl(getTemplateCreateUrlReq);
if (res != null) {
pushLog.setReturnData(JSON.toJSONString(res, features));
pushLog.setTaskStatus(res.isSuccess() ? CommonConstants.ONE_STRING : CommonConstants.TWO_STRING);
tFascPushLogService.updateById(pushLog);
if (res.isSuccess() && Common.isNotNull(res.getData())) {
return R.ok(res.getData().getTemplateCreateUrl());
} else {
return R.failed(res.getMsg());
}
}
return R.failed("res无返回");
} catch (Exception e) {
return R.failed("获取新建模板的url失败:" + e.getMessage());
}
}
/**
* @Description: 获取模板编辑的url
* @Author: hgw
* @Date: 2025-12-11 15:06:54
**/
public R<String> getEditNewTemplate(TFascPushLogService tFascPushLogService, String signTemplateId, TFascCompany company) {
try {
OpenApiClient openApiClient = new OpenApiClient(company.getAppId(), company.getAppSecret(), company.getAppUrl());
String accessToken = this.getFascToken(openApiClient, company);
TemplateClient templateClient = new TemplateClient(openApiClient);
GetTemplateEditUrlReq getTemplateEditUrlReq = new GetTemplateEditUrlReq() ;
getTemplateEditUrlReq.setOpenCorpId(company.getOpenId()) ;
getTemplateEditUrlReq.setTemplateId(signTemplateId) ;
getTemplateEditUrlReq.setAccessToken(accessToken) ;
// 新增推送日志
TFascPushLog pushLog = new TFascPushLog();
pushLog.setTransReferenceId(company.getOpenId());
pushLog.setPushData(JSON.toJSONString(getTemplateEditUrlReq, features));
pushLog.setTaskStatus(CommonConstants.ZERO_STRING);
pushLog.setTypeKey("获取模板编辑的url,signTemplateId:" + signTemplateId);
pushLog.setTypeName("获取模板编辑的url");
pushLog.setContractId(company.getId());
tFascPushLogService.save(pushLog);
BaseRes<GetTemplateEditUrlRes> res = templateClient.getTemplateEditUrl(getTemplateEditUrlReq) ;
if (res != null) {
pushLog.setReturnData(JSON.toJSONString(res, features));
pushLog.setTaskStatus(res.isSuccess() ? CommonConstants.ONE_STRING : CommonConstants.TWO_STRING);
tFascPushLogService.updateById(pushLog);
if (res.isSuccess() && Common.isNotNull(res.getData())) {
return R.ok(res.getData().getTemplateEditUrl());
} else {
return R.failed(res.getMsg());
}
}
return R.failed("res无返回");
} catch (Exception e) {
return R.failed("获取模板编辑的url:" + e.getMessage());
}
}
/** /**
* @Description: 获取模板 * @Description: 获取模板
* @Author: hgw * @Author: hgw
......
...@@ -95,10 +95,10 @@ ...@@ -95,10 +95,10 @@
SELECT SELECT
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
FROM t_fasc_company a FROM t_fasc_company a
<where> where a.DELETE_FLAG = '0'
a.DELETE_FLAG = '0' <if test="companyName != null and companyName.trim() != ''">
<include refid="tFascCompany_where"/> AND a.company_name like concat('%', #{companyName}, '%')
</where> </if>
order by a.CREATE_TIME asc order by a.CREATE_TIME asc
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment