Commit ee8441de authored by fangxinjiang's avatar fangxinjiang

Merge remote-tracking branch 'origin/MVP1.7.16' into MVP1.7.16

parents e11a8699 a053c811
......@@ -20,8 +20,11 @@ package com.yifu.cloud.plus.v1.yifu.archives.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplate;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplateDetail;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascTemplateDetailService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascTemplateService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
......@@ -51,6 +54,8 @@ public class TFascTemplateController {
private final TFascTemplateService tFascTemplateService;
private final TFascTemplateDetailService tFascTemplateDetailService;
/**
* 简单分页查询
......@@ -100,8 +105,25 @@ public class TFascTemplateController {
@SysLog("修改法大大专业版模板表")
@PutMapping
@PreAuthorize("@pms.hasPermission('archives_tfasctemplate_edit')")
public R<Boolean> updateById(@RequestBody TFascTemplate tFascTemplate) {
return R.ok(tFascTemplateService.updateById(tFascTemplate));
public R<String> updateById(@RequestBody TFascTemplate tFascTemplate) {
if (Common.isEmpty(tFascTemplate.getId())) {
return R.failed("ID不能为空");
}
TFascTemplate old = tFascTemplateService.getById(tFascTemplate.getId());
if (old == null) {
return R.failed("未找到原模板");
}
if (Common.isEmpty(tFascTemplate.getContractType())) {
return R.failed("合同类型不能为空");
}
if (Common.isNotNull(old.getContractType()) && !old.getContractType().equals(tFascTemplate.getContractType())) {
return R.failed("合同类型未变更");
}
old.setContractType(tFascTemplate.getContractType());
tFascTemplateService.updateById(old);
// 初始化字段,并重新计算模板的是否已配置
tFascTemplateDetailService.initDetailHrField(tFascTemplate.getId());
return R.ok();
}
......
......@@ -22,6 +22,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplateDetail;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascTemplateDetailService;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateDetailSearchVo;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
......@@ -113,8 +114,20 @@ public class TFascTemplateDetailController {
@SysLog("修改法大大专业版模板映射表")
@PutMapping
@PreAuthorize("@pms.hasPermission('archives_tfasctemplatedetail_edit')")
public R<Boolean> updateById(@RequestBody TFascTemplateDetail tFascTemplateDetail) {
return R.ok(tFascTemplateDetailService.updateById(tFascTemplateDetail));
public R<String> updateById(@RequestBody TFascTemplateDetail tFascTemplateDetail) {
if (Common.isEmpty(tFascTemplateDetail.getId())) {
return R.failed("ID不能为空");
}
TFascTemplateDetail old = tFascTemplateDetailService.getById(tFascTemplateDetail.getId());
if (old == null) {
return R.failed("根据ID未找到原信息");
}
// 更新映射表
tFascTemplateDetailService.updateById(tFascTemplateDetail);
// 重新刷新主模板表的必填是否已填
tFascTemplateDetailService.initFascTemplateIsMust(old.getSignTemplateId());
return R.ok();
}
/**
......
......@@ -48,4 +48,9 @@ public interface TFascTemplateDetailMapper extends BaseMapper<TFascTemplateDetai
List<TFascTemplateDetailExportVo> getTFascTemplateDetailExport(@Param("tFascTemplateDetail") TFascTemplateDetailSearchVo tFascTemplateDetail, @Param("idList") List<String> idList);
Long getTFascTemplateDetailExportCount(@Param("tFascTemplateDetail") TFascTemplateDetail tFascTemplateDetail, @Param("idList") List<String> idList);
// 查找有hr字段的明细,用来清空前加日志
List<TFascTemplateDetail> getDetailByHaveHrField(@Param("templateId") String templateId);
void initDetailHrField(@Param("templateId") String templateId);
}
......@@ -49,6 +49,14 @@ public interface TFascTemplateDetailService extends IService<TFascTemplateDetail
void listExport(HttpServletResponse response, TFascTemplateDetailSearchVo searchVo);
/**
* @Description: 变更合同类型,清空配置好的皖信字段,并重新计算模板表必填是否已配置
* @Author: hgw
* @Date: 2025/10/10 16:35
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
void initDetailHrField(String templateId);
/**
* @Description: 重新刷新主模板表的必填是否已填
* @Author: hgw
......
......@@ -259,6 +259,9 @@ public class TFascTemplateDetailServiceImpl extends ServiceImpl<TFascTemplateDet
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
// 重新计算模板的是否已配置——放到循环外面了
this.initFascTemplateIsMust(null);
for (ErrorMessage message : errorMessageList) {
if (!CommonConstants.SAVE_SUCCESS.equals(message.getMessage())) {
return R.ok(errorMessageList);
......@@ -333,10 +336,30 @@ public class TFascTemplateDetailServiceImpl extends ServiceImpl<TFascTemplateDet
if (!logList.isEmpty()) {
tFascEditLogService.saveBatch(logList);
}
// 开始检测Bingo更新模板是否已配置:
this.initFascTemplateIsMust(null);
// 重新计算模板的是否已配置——放到循环外面了
}
@Override
public void initDetailHrField(String templateId) {
List<TFascTemplateDetail> detailList = baseMapper.getDetailByHaveHrField(templateId);
if (detailList != null && !detailList.isEmpty()) {
List<TFascEditLog> logList = new ArrayList<>();
TFascEditLog logs;
for (TFascTemplateDetail detail : detailList) {
logs = new TFascEditLog();
logs.setMainId(detail.getId());
logs.setMainType(CommonConstants.TWO_STRING);
logs.setEditContent("“皖信字段”由“"+detail.getHrField()+"”→“空”;“是否已配置”由“已配置”→“未配置”");
logList.add(logs);
}
// 初始化皖信字段、是否已配置
baseMapper.initDetailHrField(templateId);
// 保存日志
tFascEditLogService.saveBatch(logList);
// 更新模板的是否已配置
this.initFascTemplateIsMust(templateId);
}
}
@Override
public R<String> initFascTemplateIsMust(String templateId) {
// 先查找:
......
......@@ -36,6 +36,7 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.TFascTemplateDetail;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TFascTemplateDetailMapper;
import com.yifu.cloud.plus.v1.yifu.archives.mapper.TFascTemplateMapper;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascEditLogService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascTemplateDetailService;
import com.yifu.cloud.plus.v1.yifu.archives.service.TFascTemplateService;
import com.yifu.cloud.plus.v1.yifu.archives.utils.FascConstants;
import com.yifu.cloud.plus.v1.yifu.archives.vo.TFascTemplateExportVo;
......@@ -71,6 +72,7 @@ public class TFascTemplateServiceImpl extends ServiceImpl<TFascTemplateMapper, T
private final TFascEditLogService tFascEditLogService;
private final TFascTemplateDetailMapper tFascTemplateDetailMapper;
private final TFascTemplateDetailService tFascTemplateDetailService;
/**
* 法大大专业版模板表简单分页查询
......@@ -251,6 +253,9 @@ public class TFascTemplateServiceImpl extends ServiceImpl<TFascTemplateMapper, T
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR, e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
}
// 重新计算模板的是否已配置
tFascTemplateDetailService.initFascTemplateIsMust(null);
for (ErrorMessage message : errorMessageList) {
if (!CommonConstants.SAVE_SUCCESS.equals(message.getMessage())) {
return R.ok(errorMessageList);
......@@ -296,10 +301,11 @@ public class TFascTemplateServiceImpl extends ServiceImpl<TFascTemplateMapper, T
editContent = "“合同类型”由“空”→“" + excel.getContractType() + "”";
} else {
editContent = "“合同类型”由“" + tUpdate.getContractType() + "”→“" + excel.getContractType() + "”";
if (Common.isNotNull(tUpdate.getIsMustEdit()) && tUpdate.getIsMustEdit().equals(CommonConstants.ONE_STRING)) {
// 此处代码去掉,因为即使变了类型,由于都是非必填,这里也是已配置
/*if (Common.isNotNull(tUpdate.getIsMustEdit()) && tUpdate.getIsMustEdit().equals(CommonConstants.ONE_STRING)) {
tUpdate.setIsMustEdit(CommonConstants.ZERO_STRING);
editContent += ";“法大大必填是否已配置”由“已配置”→“未配置”";
}
}*/
// 合同类型变更,清空明细配置:
tFascTemplateDetail = new TFascTemplateDetail();
tFascTemplateDetail.setSignTemplateId(tUpdate.getSignTemplateId());
......@@ -341,10 +347,9 @@ public class TFascTemplateServiceImpl extends ServiceImpl<TFascTemplateMapper, T
}
// 更新映射表
if (!updateDetailList.isEmpty()) {
for (TFascTemplateDetail detail : updateDetailList) {
tFascTemplateDetailMapper.updateById(detail);
}
tFascTemplateDetailService.updateBatchById(updateDetailList);
}
// 重新计算模板的是否已配置————放到循环外面了
}
}
......@@ -41,5 +41,11 @@ gz:
tid: 189061502af84752b1842e9c1ecd03d7
appUrl: https://eimapi.guazi.com
#法大大专业版fasc配置
fasc:
appId: 80003662
appSecret: DXREUVHOLEFJMWLGYFGF1JKID8YCEDWZ
appUrl: https://uat-api.fadada.com/api/v5
openId: ebcd6e2e0eb2401b9ca9239e78fad203
......@@ -61,4 +61,11 @@ gz:
appkey: hr_eny00002_test
appsecret: hr_eny00002_test_20250620
tid: c2da1d84e9bd4a30b6be5ecd209096fb
appUrl: https://eim-busin-api-test-jwtys.guazi.com
\ No newline at end of file
appUrl: https://eim-busin-api-test-jwtys.guazi.com
#法大大专业版fasc配置
fasc:
appId: 80003662
appSecret: DXREUVHOLEFJMWLGYFGF1JKID8YCEDWZ
appUrl: https://uat-api.fadada.com/api/v5
openId: ebcd6e2e0eb2401b9ca9239e78fad203
\ No newline at end of file
......@@ -206,4 +206,21 @@
</if>
</where>
</select>
<select id="getDetailByHaveHrField" resultMap="tFascTemplateDetailMap">
SELECT
a.id,a.hr_field
FROM t_fasc_template_detail a
where a.sign_template_id = #{templateId} and a.hr_field is not null and a.hr_field != ''
</select>
<!-- 修改模板的合同类型,重置皖信字段 -->
<update id="initDetailHrField">
update t_fasc_template_detail
set hr_field = null,
hr_field_id = null,
is_edit = '0'
where sign_template_id = #{templateId}
</update>
</mapper>
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