Commit 905cd3bf authored by huyuchen's avatar huyuchen

fdd 代码修改

parent f469fcf2
......@@ -174,16 +174,16 @@ public class FddContractAttachInfoController {
List<ErrorMessage> errorInfo = fddContractAttachInfoService.batchAdd(util1.getEntityList());
Map<String,Object> variableMap = new HashMap<>();
Map<Integer,Object> map = new HashMap<>();
boolean allExitContract = errorInfo.stream().allMatch(e-> checkInfo(e));
boolean allExitContract = errorInfo.stream().allMatch(e-> e.getMessage().equals("存在“在用”的合同"));
if (allExitContract) {
variableMap.put("allMatch","true");
for (ErrorMessage errorMessage :errorInfo){
map.put(errorMessage.getLineNum(),util1.getEntityList().get(errorMessage.getLineNum()-2));
}
variableMap.put("data",map);
return R.ok(variableMap);
return R.ok(variableMap,"存在“在用”的合同");
}
return new R<>(CommonConstants.dingleDigitIntArray[1], "", errorInfo);
return R.failed(errorInfo,"");
} else {
return R.ok(null,"无数据可导入");
}
......@@ -273,9 +273,4 @@ public class FddContractAttachInfoController {
List<ErrorMessage> errorInfo = fddContractAttachInfoService.sendTask(entityList);
return R.ok(errorInfo);
}
public boolean checkInfo(ErrorMessage errorMessage) {
Set<String> set = errorMessage.getErrors();
return set.stream().allMatch(e-> e.equals("存在“在用”的合同"));
}
}
......@@ -147,6 +147,7 @@ public class FddController {
@Operation(summary = "异步通知", description = "异步通知")
@RequestMapping(value = "/notifyUrl")
public R<String> notifyUrl(HttpServletRequest request, HttpServletResponse response) throws Exception {
YifuUser user = SecurityUtils.getUser();
checkSign(request);
String fddEvent = request.getHeader(FDD_EVENT);
String fddBizContent = request.getParameter(FDD_BIZ_CONTENT);
......@@ -159,7 +160,6 @@ public class FddController {
if (StringUtils.equals(CommonConstants.TWO_STRING, jsonObject.getString("status"))) {
//成功
FddPersonAccount entity = fddPersonAccountService.getById(clientId);
YifuUser user = SecurityUtils.getUser();
if (entity != null) {
entity.setRealStatus(CommonConstants.ONE_STRING);
entity.setUnionid(unionId);
......@@ -221,7 +221,7 @@ public class FddController {
e.printStackTrace();
}
});
return R.ok(null,"success");
return R.ok(null,"成功");
}
}
} else if (StringUtils.equals(fddEvent, "sign")) {
......@@ -254,7 +254,7 @@ public class FddController {
// 2021-3-15 16:24 hgw 全部签名成功,更新合同的状态:
if (CommonConstants.TWO_STRING.equals(fddContractInfo.getSendSignStatus())
&& CommonConstants.TWO_STRING.equals(fddContractInfo.getReceiveSignStatus())) {
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo);
fddContractAttachInfoService.saveEmpAndAttarch(fddContractInfo,user);
TEmployeeContractInfo ec = employeeContractInfoService.getById(fddContractInfo.getContractId());
// 如果合同的状态是待电子签,则变更为已电子签
......@@ -263,7 +263,7 @@ public class FddController {
employeeContractInfoService.updateById(ec);
}
}
return R.ok(null,"success");
return R.ok(null,"成功");
}else if (StringUtils.equals(fddEvent, "notifyUrlVerify")) {
return R.ok(null,"success");
}
......
......@@ -25,8 +25,8 @@ import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractAttachInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.FddContractInfo;
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.core.vo.YifuUser;
import java.io.InputStream;
import java.util.List;
/**
......@@ -53,7 +53,7 @@ public interface FddContractAttachInfoService extends IService<FddContractAttach
List<ErrorMessage> sendTask(List<FddContractAttachInfo> entityList);
R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo);
R<String> saveEmpAndAttarch(FddContractInfo fddContractInfo, YifuUser user);
List<ErrorMessage> batchAdd(List<FddContractAttachInfo> entityList);
......
......@@ -74,6 +74,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.*;
......@@ -118,9 +119,16 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
private OSSUtil ossUtil;
@Autowired
private TSettleDomainService tSettleDomainService;
@Autowired
private TAttaInfoService tAttaInfoService;
@Override
public R<String> saveEmpContract(FddContractAttachInfo fddContractAttachInfo,YifuUser user) throws ApiException {
long haveFddConCount = this.count(Wrappers.<FddContractInfo>query().lambda().eq(FddContractInfo::getContractId, fddContractAttachInfo.getContractId())
.eq(FddContractInfo::getDeleteFlag, CommonConstants.ZERO_STRING));
if (haveFddConCount > CommonConstants.ZERO_INT) {
return R.failed("已存在法大大电子合同");
}
if (!user.getId().equals(fddContractAttachInfo.getCreateBy())) {
return R.failed("当前用户不是电子合同导入用户,不能操作");
}
......@@ -576,17 +584,25 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
String key = name + ".zip";
ossUtil.uploadFileByStream(bis, key, null);
// 1:保存为
// TEmpAtta empAtta = BasicServiceUtil.initTEmpAttaForInsert(name, key, (long) rspData.getFileBytes().length);
// empAttaService.save(empAtta);
// MEmpContractAtta contractAtta = new MEmpContractAtta();
// contractAtta.setAttaId(empAtta.getId());
// contractAtta.setContractId(employeeContractInfo.getId());
// mempContractAttaService.save(contractAtta);
TAttaInfo attaInfo = initUnitAttaForInsert(name, key, (long)rspData.getFileBytes().length);
attaInfo.setRelationType(CommonConstants.FOUR_STRING);
attaInfo.setDomainId(fddContractInfo.getId());
tAttaInfoService.save(attaInfo);
FddContractAttachInfo fddContractAttachInfo = fddContractAttachInfoMapper.selectOne(Wrappers.<FddContractAttachInfo>query().lambda()
.eq(FddContractAttachInfo::getContractId,entity.getContractId()).last(CommonConstants.LAST_ONE_SQL));
if (fddContractAttachInfo != null) {
fddContractAttachInfo.setIsMove(CommonConstants.ONE_INT);
fddContractAttachInfoMapper.updateById(fddContractAttachInfo);
TEmployeeContractInfo tEmployeeContractInfo = employeeContractInfoService.getOne(Wrappers.<TEmployeeContractInfo>query().lambda()
.eq(TEmployeeContractInfo::getId,fddContractAttachInfo.getContractId())
.eq(TEmployeeContractInfo::getDeleteFlag,CommonConstants.ZERO_STRING)
.eq(TEmployeeContractInfo::getInUse,CommonConstants.ZERO_STRING)
.last(CommonConstants.LAST_ONE_SQL));
tEmployeeContractInfo.setIsFile(CommonConstants.ZERO_STRING);
employeeContractInfoService.updateById(tEmployeeContractInfo);
}
return R.ok();
} finally {
......@@ -921,4 +937,24 @@ public class FddContractInfoServiceImpl extends ServiceImpl<FddContractInfoMappe
return R.failed(rsp.getMsg());
}
}
/**
* 对象初始化
* @param fileName
* @param key
* @param fileSize
* @return
*/
private TAttaInfo initUnitAttaForInsert(String fileName, String key, long fileSize) {
TAttaInfo unitAtta = new TAttaInfo();
char point = '.';
unitAtta.setAttaName(fileName);
unitAtta.setAttaSize(fileSize);
unitAtta.setAttaSrc(key);
if (key.lastIndexOf(point) >= 0) {
unitAtta.setAttaType(key.substring(key.lastIndexOf(point)));
}
unitAtta.setCreateTime(LocalDateTime.now());
return unitAtta;
}
}
......@@ -119,6 +119,6 @@
1=1
<include refid="fddPersonAccount_where"/>
</where>
GROUP BY a.ID_CARD ORDER BY a.CREATE_TIME desc
GROUP BY a.ID_CARD,a.MOBLIE ORDER BY a.CREATE_TIME desc
</select>
</mapper>
......@@ -124,6 +124,8 @@ public interface CommonConstants {
String FOUR_STRING = "4";
String FIVE_STRING = "5";
/**
* number 0
*/
......
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CacheConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.ExcelAttribute;
......@@ -950,4 +951,23 @@ public class ExcelUtil <T> implements Serializable {
this.setErrorInfo(errorList);
this.setErrorMessageHashMap(errorMessageHashMap);
}
/**
* @param clazz
* @Author: wangan
* @Date: 2020/9/28
* @Description: 获取导出中文字段
* @return: com.yifu.cloud.v1.common.core.util.R
**/
public static R<List<String>> getExportfieldsName(Class<?> clazz){
ArrayList<String> exportfieldsName = Lists.newArrayList();
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
ExcelAttribute annotation = field.getAnnotation(ExcelAttribute.class);
if (annotation != null && Common.isNotNull(annotation.name()) && annotation.needExport()) {
exportfieldsName.add(annotation.name());
}
}
return R.ok(exportfieldsName,"成功");
}
}
......@@ -149,6 +149,11 @@ public class LocalDateUtil {
return flag;
}
//获取指定时间的指定格式
public static String formatTime(LocalDate time, String pattern) {
return time.format(DateTimeFormatter.ofPattern(pattern));
}
public static void main(String[] args) {
System.out.println(isCurrentOrFutureMonth("2023-1"));
}
......
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