diff --git a/src/com/engine/salary/service/LyPZService.java b/src/com/engine/salary/service/LyPZService.java index ed8af0bfd..d69842e1b 100644 --- a/src/com/engine/salary/service/LyPZService.java +++ b/src/com/engine/salary/service/LyPZService.java @@ -31,6 +31,7 @@ public interface LyPZService { Map listAllFrzt(); + Integer getIdByName(String name); /** * 辅助核算浏览框 * diff --git a/src/com/engine/salary/service/impl/LyPZServiceImpl.java b/src/com/engine/salary/service/impl/LyPZServiceImpl.java index ba4ff40a2..29f9ed7fb 100644 --- a/src/com/engine/salary/service/impl/LyPZServiceImpl.java +++ b/src/com/engine/salary/service/impl/LyPZServiceImpl.java @@ -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 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> 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("")+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 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 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> 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); + } } } // }