领悦 加锁解锁

This commit is contained in:
Harryxzy 2025-05-19 17:01:58 +08:00
parent 89a8cf7415
commit 297e83e15f
2 changed files with 96 additions and 1 deletions

View File

@ -31,6 +31,7 @@ public interface LyPZService {
Map<String, String> listAllFrzt();
Integer getIdByName(String name);
/**
* 辅助核算浏览框
*

View File

@ -40,6 +40,7 @@ import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import weaver.conn.RecordSet;
import weaver.formmode.setup.ModeRightInfo;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.hrm.User;
@ -477,6 +478,18 @@ public class LyPZServiceImpl extends Service implements LyPZService {
return resultMap;
}
public Integer getIdByName(String name) {
if (StringUtils.isBlank(name)) {
return 0;
}
RecordSet rs = new RecordSet();
rs.execute("select id from uf_frzt where (sfqy =0 or sfqy is null) and frzt ='" + name +"'");
while (rs.next()) {
return rs.getInt("id");
}
return 0;
}
/**
* 根据凭证编码获取浏览框
* @param fzhsBmList
@ -991,6 +1004,47 @@ public class LyPZServiceImpl extends Service implements LyPZService {
.deleteType(0).build();
getLyVoucherDetailMapper().insertIgnoreNull(voucherDetail);
});
// 如果推送成功且为社保公积金凭证则修将建模数据锁定
if (pushParam.getStatus().equals(LyPushStatusEnum.SUCCESS.getValue()) && (!pushParam.getPzlx().equals(LyPZTypeEnum.XZJTPZ.getValue())) && (!pushParam.getPzlx().equals(LyPZTypeEnum.XZFFPZ.getValue()))) {
Integer gsId = getIdByName(pushParam.getFfgsqc());
RecordSet rs = new RecordSet();
String sql = "";
List<Integer> needUpdateIds = new ArrayList<>();
if (gsId != null && gsId != 0) {
if (pushParam.getPzlx().equals(LyPZTypeEnum.SBFFPZ.getValue()) || pushParam.getPzlx().equals(LyPZTypeEnum.SBJTPZ.getValue())) {
sql = "select id from uf_sbgjj where fyszq = '"+pushParam.getSalaryMonth()+"' and gmgsqc=" + gsId;
rs.execute(sql);
while (rs.next()) {
needUpdateIds.add(rs.getInt("id"));
}
} else if (pushParam.getPzlx().equals(LyPZTypeEnum.GJJFFPZ.getValue()) || pushParam.getPzlx().equals(LyPZTypeEnum.GJJJTPZ.getValue())) {
sql = "select id from uf_sbgjj where fyszq = '"+pushParam.getSalaryMonth()+"' and fycdgsqc=" + gsId;
rs.execute(sql);
while (rs.next()) {
needUpdateIds.add(rs.getInt("id"));
}
}
// 入库
if (CollectionUtils.isNotEmpty(needUpdateIds)) {
List<List<Integer>> partition = Lists.partition(needUpdateIds, 800);
partition.forEach( part -> {
String idStr = StringUtils.join(part, ",");
String updateSql = "update uf_sbgjj set sjsd = 0 where id in (" + idStr + ")";
rs.execute(updateSql);
});
// 获取社保公积金模块id
BaseBean baseBean = new BaseBean();
Integer modeId = NumberUtils.isCreatable(baseBean.getPropValue("lySalaryNCVoucher", "sbgjj_mode_id"))
? Integer.valueOf(baseBean.getPropValue("lySalaryNCVoucher", "sbgjj_mode_id")) : 0;
// 权限重构
for (Integer id : needUpdateIds) {
ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare(1, modeId, id);
}
}
}
}
resultMap.put("status", (pushParam.getStatus() != null && pushParam.getStatus().equals(NumberUtils.INTEGER_ONE)) ? Boolean.TRUE : Boolean.FALSE);
resultMap.put("errMsg", pushParam.getPushMsg());
return resultMap;
@ -1238,7 +1292,6 @@ public class LyPZServiceImpl extends Service implements LyPZService {
httpPost.setRequestEntity(entity);
httpClient.executeMethod(httpPost);
result = httpPost.getResponseBodyAsString();
System.out.println(result);
LyNCVoucherReturn lyNCVoucherReturn = XStreamUtil.unmarshal(LyNCVoucherReturn.class, StringUtils.substring(result,result.indexOf("<ufinterface"),result.indexOf("</ufinterface>")+14));
boolean success = lyNCVoucherReturn.getSuccessful().equals("Y");
if (!success) {
@ -1397,6 +1450,11 @@ public class LyPZServiceImpl extends Service implements LyPZService {
getLyVoucherDetailMapper().deleteByVoucherId(voucherId);
Integer status = voucherPO.getStatus();
if (status != null && status.equals(LyPushStatusEnum.SUCCESS.getValue())) {
Integer gsId = getIdByName(voucherPO.getFfgsqc());
RecordSet rs = new RecordSet();
String sql = "";
List<Integer> needUpdateIds = new ArrayList<>();
String formatYearMonth = SalaryDateUtil.getFormatYearMonth(voucherPO.getSalaryMonth());
// 修改报表中数据推送状态
Integer pzlx = voucherPO.getPzlx();
String dataSourceStr = voucherPO.getDataSource();
@ -1427,6 +1485,14 @@ public class LyPZServiceImpl extends Service implements LyPZService {
}
getLySocialReportService(user).updateIgnoreNull(po);
});
if (gsId != null && gsId != 0) {
sql = "select id from uf_sbgjj where fyszq = '" + formatYearMonth + "' and gmgsqc=" + gsId + " and sjsd = 0";
rs.execute(sql);
while (rs.next()) {
needUpdateIds.add(rs.getInt("id"));
}
}
} else if (pzlx.equals(LyPZTypeEnum.GJJJTPZ.getValue()) || pzlx.equals(LyPZTypeEnum.GJJFFPZ.getValue())) {
// 公积金
List<LyFundReportPO> lyFundReportList = getLyFundReportService(user).getByIds(dataSourceIdList);
@ -1438,6 +1504,34 @@ public class LyPZServiceImpl extends Service implements LyPZService {
}
getLyFundReportService(user).updateIgnoreNull(po);
});
if (gsId != null && gsId != 0) {
sql = "select id from uf_sbgjj where fyszq = '" + formatYearMonth + "' and fycdgsqc=" + gsId + " and sjsd = 0";
rs.execute(sql);
while (rs.next()) {
needUpdateIds.add(rs.getInt("id"));
}
}
}
// 入库
if (CollectionUtils.isNotEmpty(needUpdateIds)) {
List<List<Integer>> partition = Lists.partition(needUpdateIds, 800);
partition.forEach( part -> {
String idStr = StringUtils.join(part, ",");
String updateSql = "update uf_sbgjj set sjsd = 1 where id in (" + idStr + ")";
rs.execute(updateSql);
});
// 获取社保公积金模块id
BaseBean baseBean = new BaseBean();
Integer modeId = NumberUtils.isCreatable(baseBean.getPropValue("lySalaryNCVoucher", "sbgjj_mode_id"))
? Integer.valueOf(baseBean.getPropValue("lySalaryNCVoucher", "sbgjj_mode_id")) : 0;
// 权限重构
for (Integer id : needUpdateIds) {
ModeRightInfo ModeRightInfo = new ModeRightInfo();
ModeRightInfo.setNewRight(true);
ModeRightInfo.editModeDataShare(1, modeId, id);
}
}
}
// }