yuanzhi_kuang vor 2 Monaten
Ursprung
Commit
90e7e56c28

+ 20 - 0
GDYSL/src/com/kingdee/shr/compensation/IRetMoneyFacade.java

@@ -0,0 +1,20 @@
+package com.kingdee.shr.compensation;
+
+import com.kingdee.bos.BOSException;
+//import com.kingdee.bos.metadata.*;
+import com.kingdee.bos.framework.*;
+import com.kingdee.bos.util.*;
+import com.kingdee.bos.Context;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.util.*;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.framework.*;
+
+public interface IRetMoneyFacade extends IBizCtrl
+{
+    public void retMoney() throws BOSException, EASBizException;
+    public void synSalaryData() throws BOSException, EASBizException;
+    public void synmpPosOrgRelatio() throws BOSException, EASBizException;
+}

+ 72 - 0
GDYSL/src/com/kingdee/shr/compensation/RetMoneyFacade.java

@@ -0,0 +1,72 @@
+package com.kingdee.shr.compensation;
+
+import com.kingdee.bos.framework.ejb.EJBRemoteException;
+import com.kingdee.bos.util.BOSObjectType;
+import java.rmi.RemoteException;
+import com.kingdee.bos.framework.AbstractBizCtrl;
+import com.kingdee.bos.orm.template.ORMObject;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.util.*;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.shr.compensation.app.*;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.framework.*;
+
+public class RetMoneyFacade extends AbstractBizCtrl implements IRetMoneyFacade
+{
+    public RetMoneyFacade()
+    {
+        super();
+        registerInterface(IRetMoneyFacade.class, this);
+    }
+    public RetMoneyFacade(Context ctx)
+    {
+        super(ctx);
+        registerInterface(IRetMoneyFacade.class, this);
+    }
+    public BOSObjectType getType()
+    {
+        return new BOSObjectType("E9D4CD3B");
+    }
+    private RetMoneyFacadeController getController() throws BOSException
+    {
+        return (RetMoneyFacadeController)getBizController();
+    }
+    /**
+     *推送报文-User defined method
+     */
+    public void retMoney() throws BOSException, EASBizException
+    {
+        try {
+            getController().retMoney(getContext());
+        }
+        catch(RemoteException err) {
+            throw new EJBRemoteException(err);
+        }
+    }
+    /**
+     *同步预入薪酬设计-User defined method
+     */
+    public void synSalaryData() throws BOSException, EASBizException
+    {
+        try {
+            getController().synSalaryData(getContext());
+        }
+        catch(RemoteException err) {
+            throw new EJBRemoteException(err);
+        }
+    }
+    /**
+     *同步任职信息-User defined method
+     */
+    public void synmpPosOrgRelatio() throws BOSException, EASBizException
+    {
+        try {
+            getController().synmpPosOrgRelatio(getContext());
+        }
+        catch(RemoteException err) {
+            throw new EJBRemoteException(err);
+        }
+    }
+}

+ 30 - 0
GDYSL/src/com/kingdee/shr/compensation/RetMoneyFacadeFactory.java

@@ -0,0 +1,30 @@
+package com.kingdee.shr.compensation;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.BOSObjectFactory;
+import com.kingdee.bos.util.BOSObjectType;
+import com.kingdee.bos.Context;
+
+public class RetMoneyFacadeFactory
+{
+    private RetMoneyFacadeFactory()
+    {
+    }
+    public static com.kingdee.shr.compensation.IRetMoneyFacade getRemoteInstance() throws BOSException
+    {
+        return (com.kingdee.shr.compensation.IRetMoneyFacade)BOSObjectFactory.createRemoteBOSObject(new BOSObjectType("E9D4CD3B") ,com.kingdee.shr.compensation.IRetMoneyFacade.class);
+    }
+    
+    public static com.kingdee.shr.compensation.IRetMoneyFacade getRemoteInstanceWithObjectContext(Context objectCtx) throws BOSException
+    {
+        return (com.kingdee.shr.compensation.IRetMoneyFacade)BOSObjectFactory.createRemoteBOSObjectWithObjectContext(new BOSObjectType("E9D4CD3B") ,com.kingdee.shr.compensation.IRetMoneyFacade.class, objectCtx);
+    }
+    public static com.kingdee.shr.compensation.IRetMoneyFacade getLocalInstance(Context ctx) throws BOSException
+    {
+        return (com.kingdee.shr.compensation.IRetMoneyFacade)BOSObjectFactory.createBOSObject(ctx, new BOSObjectType("E9D4CD3B"));
+    }
+    public static com.kingdee.shr.compensation.IRetMoneyFacade getLocalInstance(String sessionID) throws BOSException
+    {
+        return (com.kingdee.shr.compensation.IRetMoneyFacade)BOSObjectFactory.createBOSObject(sessionID, new BOSObjectType("E9D4CD3B"));
+    }
+}

+ 106 - 0
GDYSL/src/com/kingdee/shr/compensation/app/AbstractRetMoneyFacadeControllerBean.java

@@ -0,0 +1,106 @@
+package com.kingdee.shr.compensation.app;
+
+import javax.ejb.*;
+import java.rmi.RemoteException;
+import com.kingdee.bos.*;
+import com.kingdee.bos.util.BOSObjectType;
+import com.kingdee.bos.metadata.IMetaDataPK;
+import com.kingdee.bos.metadata.rule.RuleExecutor;
+import com.kingdee.bos.metadata.MetaDataPK;
+//import com.kingdee.bos.metadata.entity.EntityViewInfo;
+import com.kingdee.bos.framework.ejb.AbstractEntityControllerBean;
+import com.kingdee.bos.framework.ejb.AbstractBizControllerBean;
+//import com.kingdee.bos.dao.IObjectPK;
+import com.kingdee.bos.dao.IObjectValue;
+import com.kingdee.bos.dao.IObjectCollection;
+import com.kingdee.bos.service.ServiceContext;
+import com.kingdee.bos.service.IServiceContext;
+import com.kingdee.eas.framework.Result;
+import com.kingdee.eas.framework.LineResult;
+import com.kingdee.eas.framework.exception.EASMultiException;
+import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
+
+import com.kingdee.eas.common.EASBizException;
+
+
+
+public abstract class AbstractRetMoneyFacadeControllerBean extends AbstractBizControllerBean implements RetMoneyFacadeController
+{
+    protected AbstractRetMoneyFacadeControllerBean()
+    {
+    }
+
+    protected BOSObjectType getBOSType()
+    {
+        return new BOSObjectType("E9D4CD3B");
+    }
+
+    public void retMoney(Context ctx) throws BOSException, EASBizException
+    {
+        try {
+            ServiceContext svcCtx = createServiceContext(new MetaDataPK("95f6569e-5afd-428b-b63f-206820e58295"), new Object[]{ctx});
+            invokeServiceBefore(svcCtx);
+              if(!svcCtx.invokeBreak()) {
+            _retMoney(ctx);
+            }
+            invokeServiceAfter(svcCtx);
+        } catch (BOSException ex) {
+            this.setRollbackOnly();
+            throw ex;
+        } catch (EASBizException ex0) {
+            this.setRollbackOnly();
+            throw ex0;
+        } finally {
+            super.cleanUpServiceState();
+        }
+    }
+    protected void _retMoney(Context ctx) throws BOSException, EASBizException
+    {    	
+        return;
+    }
+
+    public void synSalaryData(Context ctx) throws BOSException, EASBizException
+    {
+        try {
+            ServiceContext svcCtx = createServiceContext(new MetaDataPK("c1e9fceb-8006-4e0a-865f-e36dc6251453"), new Object[]{ctx});
+            invokeServiceBefore(svcCtx);
+              if(!svcCtx.invokeBreak()) {
+            _synSalaryData(ctx);
+            }
+            invokeServiceAfter(svcCtx);
+        } catch (BOSException ex) {
+            throw ex;
+        } catch (EASBizException ex0) {
+            throw ex0;
+        } finally {
+            super.cleanUpServiceState();
+        }
+    }
+    protected void _synSalaryData(Context ctx) throws BOSException, EASBizException
+    {    	
+        return;
+    }
+
+    public void synmpPosOrgRelatio(Context ctx) throws BOSException, EASBizException
+    {
+        try {
+            ServiceContext svcCtx = createServiceContext(new MetaDataPK("24ce3c75-7bda-4afe-9eb2-d5b332a33ba4"), new Object[]{ctx});
+            invokeServiceBefore(svcCtx);
+              if(!svcCtx.invokeBreak()) {
+            _synmpPosOrgRelatio(ctx);
+            }
+            invokeServiceAfter(svcCtx);
+        } catch (BOSException ex) {
+            throw ex;
+        } catch (EASBizException ex0) {
+            throw ex0;
+        } finally {
+            super.cleanUpServiceState();
+        }
+    }
+    protected void _synmpPosOrgRelatio(Context ctx) throws BOSException, EASBizException
+    {    	
+        return;
+    }
+
+}

+ 23 - 0
GDYSL/src/com/kingdee/shr/compensation/app/RetMoneyFacadeController.java

@@ -0,0 +1,23 @@
+package com.kingdee.shr.compensation.app;
+
+import com.kingdee.bos.BOSException;
+//import com.kingdee.bos.metadata.*;
+import com.kingdee.bos.framework.*;
+import com.kingdee.bos.util.*;
+import com.kingdee.bos.Context;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.util.*;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.framework.*;
+
+import java.rmi.RemoteException;
+import com.kingdee.bos.framework.ejb.BizController;
+
+public interface RetMoneyFacadeController extends BizController
+{
+    public void retMoney(Context ctx) throws BOSException, EASBizException, RemoteException;
+    public void synSalaryData(Context ctx) throws BOSException, EASBizException, RemoteException;
+    public void synmpPosOrgRelatio(Context ctx) throws BOSException, EASBizException, RemoteException;
+}

+ 234 - 0
GDYSL/src/com/kingdee/shr/compensation/app/RetMoneyFacadeControllerBean.java

@@ -0,0 +1,234 @@
+//
+// Source code recreated from a .class file by IntelliJ IDEA
+// (powered by FernFlower decompiler)
+//
+
+package com.kingdee.shr.compensation.app;
+
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.Context;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.eas.util.app.DbUtil;
+import com.kingdee.jdbc.rowset.IRowSet;
+import com.kingdee.shr.compensation.util.CmpStrUtil;
+import com.kingdee.util.DateTimeUtils;
+import java.math.BigDecimal;
+import java.sql.SQLException;
+import java.text.ParseException;
+import java.time.LocalDate;
+import java.time.Period;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+import org.apache.log4j.Logger;
+
+public class RetMoneyFacadeControllerBean extends AbstractRetMoneyFacadeControllerBean {
+    private static Logger logger = Logger.getLogger("com.kingdee.shr.compensation.app.RetMoneyFacadeControllerBean");
+
+    public RetMoneyFacadeControllerBean() {
+    }
+
+    protected void _retMoney(Context ctx) throws BOSException, EASBizException {
+        String sql = "/*dialect*/ SELECT FMONEY ,FID ,FPERSONID ,FCMPITEMID,FEFFECTDAY ,FLEFFECTDAY,CFTraceability,CFRetroactiveDate,foldfixadjustsalaryid   FROM T_HR_SFixAdjustSalary where  sysdate between   FEFFECTDAY  and FLEFFECTDAY and CFTraceability='Yes'   and (CFIsRet is null or CFIsRet=0)";
+        HashSet list = new HashSet();
+        logger.error("sql" + sql);
+        IRowSet rs = DbUtil.executeQuery(ctx, sql);
+
+        try {
+            BigDecimal money;
+            for(; rs.next(); logger.error("end mainid ==============" + money)) {
+                BigDecimal sumMoney = BigDecimal.ZERO;
+                money = rs.getBigDecimal("FMONEY");
+                logger.error("statrt mainid ==============" + money);
+                Date cfretroactivedate = rs.getDate("cfretroactivedate");
+                logger.error("cfretroactivedate " + DateTimeUtils.format(cfretroactivedate));
+                String personid = rs.getString("FPERSONID");
+                logger.error("personid " + personid);
+                String cmpitemid = rs.getString("FCMPITEMID");
+                Date mainEffectday = rs.getDate("FEFFECTDAY");
+                Date mainLeffectday = rs.getDate("FLEFFECTDAY");
+                String mainleftdayYearMonth = DateTimeUtils.format(mainEffectday, "yyyy-MM");
+                logger.error("mainleftdayYearMonth " + mainleftdayYearMonth);
+                String oldfixadjustsalaryid = rs.getString("foldfixadjustsalaryid");
+                String id = rs.getString("fid");
+                String detialSql = "/*dialect*/ select FEFFECTDAY ,FLEFFECTDAY,FMONEY,fid from T_HR_SFixAdjustSalary where FCMPITEMID='" + cmpitemid + "' " + " and fid ='" + oldfixadjustsalaryid + "' and  FPERSONID='" + personid + "' " + "   and (CFIsRet is null or CFIsRet=0) order by FEFFECTDAY asc ";
+                logger.error("detial sql " + detialSql);
+                list.add(id);
+                IRowSet dettaiRs = DbUtil.executeQuery(ctx, detialSql);
+                logger.error("cfretroactivedate " + cfretroactivedate);
+                String detialid;
+                if (dettaiRs != null && dettaiRs.size() > 0) {
+                    while(dettaiRs.next()) {
+                        detialid = dettaiRs.getString("fid");
+                        logger.error("start detialid================================= " + dettaiRs.getString("fid"));
+                        BigDecimal detailMony = dettaiRs.getBigDecimal("FMONEY");
+                        logger.error("dettaiRs:retMoney " + detailMony);
+                        BigDecimal retMoney = money.subtract(dettaiRs.getBigDecimal("FMONEY"));
+                        logger.error("retMoney " + retMoney);
+                        Date effectday = dettaiRs.getDate("FEFFECTDAY");
+                        Date leffectday = dettaiRs.getDate("FLEFFECTDAY");
+                        logger.error("detial_effectday " + DateTimeUtils.format(effectday));
+                        logger.error("detial_leffectday " + DateTimeUtils.format(leffectday));
+                        logger.error("detial_leffectday_before " + cfretroactivedate.before(effectday));
+                        HashSet<String> monthSet = null;
+                        int months = 0;
+                        String beginYearMonth;
+                        String endYearMonth;
+                        int detiailbeginday;
+                        Date lastDate;
+                        int days;
+                        BigDecimal arrMoney;
+                        long cntdays;
+
+                        if (cfretroactivedate.before(effectday)) {
+                            beginYearMonth = DateTimeUtils.format(effectday, "yyyy-MM");
+                            logger.error("beginYearMonth" + beginYearMonth);
+                            endYearMonth = DateTimeUtils.format(leffectday, "yyyy-MM");
+                            logger.error("endYearMonth" + endYearMonth);
+                            monthSet = getMonthBetweenDate(effectday, leffectday);
+                            logger.error("monthSet" + monthSet);
+                            months = this.getAllMonth(effectday, leffectday);
+                            logger.error("detial_months " + months);
+                            detiailbeginday = DateTimeUtils.getDay(effectday);
+                            logger.error("detiailbeginday " + detiailbeginday);
+                            lastDate = this.getlengthOfMonth(effectday);
+                            if (detiailbeginday != 1) {
+                                days = DateTimeUtils.getDay(lastDate);
+                                logger.error("detial_all_days " + days);
+                                arrMoney = retMoney.divide(new BigDecimal(days), 5).setScale(2);
+                                logger.error("detial_arrMoney " + arrMoney);
+                                cntdays = this.getDaysBetweenDates(effectday, (Date)(lastDate.after(leffectday) ? leffectday : lastDate)) + 1L;
+                                logger.error("detial_cntdays " + cntdays);
+                                sumMoney = sumMoney.add(arrMoney.multiply(new BigDecimal(cntdays)));
+                                logger.error("detial_sumMoney " + sumMoney);
+                                monthSet.remove(beginYearMonth);
+                            }
+
+                            if (mainleftdayYearMonth.equals(endYearMonth)) {
+                                monthSet.remove(endYearMonth);
+                            }
+                        } else {
+                            months = this.getAllMonth(cfretroactivedate, leffectday);
+                            beginYearMonth = DateTimeUtils.format(cfretroactivedate, "yyyy-MM");
+                            logger.error("beginYearMonth" + beginYearMonth);
+                            endYearMonth = DateTimeUtils.format(leffectday, "yyyy-MM");
+                            logger.error("endYearMonth" + endYearMonth);
+                            monthSet = getMonthBetweenDate(cfretroactivedate, leffectday);
+                            logger.error("monthSet" + monthSet);
+                            logger.error("detial_months " + months);
+                            detiailbeginday = DateTimeUtils.getDay(cfretroactivedate);
+                            logger.error("detiailbeginday " + detiailbeginday);
+                            lastDate = this.getlengthOfMonth(cfretroactivedate);
+                            if (detiailbeginday != 1) {
+                                days = DateTimeUtils.getDay(lastDate);
+                                logger.error("detial_all_days " + days);
+                                arrMoney = retMoney.divide(new BigDecimal(days), 5).setScale(2);
+                                logger.error("arrMoney " + arrMoney);
+                                cntdays = this.getDaysBetweenDates(cfretroactivedate, (Date)(lastDate.after(leffectday) ? leffectday : lastDate)) + 1L;
+                                logger.error("detial_cntdays " + cntdays);
+                                sumMoney = sumMoney.add(arrMoney.multiply(new BigDecimal(cntdays)));
+                                logger.error("detial_sumMoney " + sumMoney);
+                                monthSet.remove(endYearMonth);
+                            }
+
+                            if (mainleftdayYearMonth.equals(endYearMonth)) {
+                                monthSet.remove(endYearMonth);
+                            }
+                        }
+
+                        logger.error("monthSet ret " + monthSet);
+                        if (monthSet.size() > 0) {
+                            sumMoney = sumMoney.add(retMoney.multiply(new BigDecimal(monthSet.size())));
+                        }
+
+                        logger.error("sumMoney " + sumMoney);
+                        list.add(detialid);
+                        logger.error("end detialid================================= " + dettaiRs.getString("fid"));
+                    }
+                } else {
+                    logger.error("没有调薪历史都是0");
+                    sumMoney = BigDecimal.ZERO;
+                }
+
+                detialid = "select * from CT_CUS_PersonPayForm where CFPersonID ='" + personid + "' and CFAdjustSalary='" + id + "' ";
+                logger.error("exiSql sql " + detialid);
+                IRowSet extRs = DbUtil.executeQuery(ctx, detialid);
+                String insertSql;
+                if (extRs != null && extRs.size() > 0) {
+                    insertSql = "update  CT_CUS_PersonPayForm set CFRetMoney=" + sumMoney.setScale(2, 5) + " where  CFAdjustSalary='" + id + "' ";
+                    logger.error("updateSql " + insertSql);
+                    DbUtil.execute(ctx, insertSql);
+                } else {
+                    insertSql = " /*dialect*/ insert into CT_CUS_PersonPayForm(fid,CFPersonID,CFMonth,CFRetMoney,cfadjustsalary) values(newbosid('5FB9A7AC'),'" + personid + "',to_date('" + DateTimeUtils.format(mainEffectday) + "','yyyy-MM-dd')" + "," + sumMoney.setScale(2, 5) + ",'" + id + "')";
+                    logger.error("insertSql " + insertSql);
+                    DbUtil.execute(ctx, insertSql);
+                }
+            }
+
+            String idStr = CmpStrUtil.convertListToString(list.toArray());
+            logger.error("insqlInstance idStr " + CmpStrUtil.convertListToString(list.toArray()));
+            String updateAdjustSalarySql = "update T_HR_SFixAdjustSalary set cfisret=1 where fid in ( " + idStr + ") ";
+            logger.error("updateAdjustSalarySql" + updateAdjustSalarySql);
+            DbUtil.execute(ctx, updateAdjustSalarySql);
+        } catch (SQLException var32) {
+            var32.printStackTrace();
+            throw new BOSException("回算出错");
+        } catch (ParseException var33) {
+            var33.printStackTrace();
+            throw new BOSException("回算出错");
+        }
+    }
+
+    public int getALlDays(int year, int month) {
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(year, month, 1);
+        int daysInMonth = calendar.getActualMaximum(5);
+        return daysInMonth;
+    }
+
+    public int getAllMonth(Date beginDate, Date endDate) {
+        LocalDate startDatetmp = LocalDate.of(DateTimeUtils.getYear(beginDate), DateTimeUtils.getMonth(beginDate), DateTimeUtils.getDay(beginDate));
+        LocalDate endDatetmp = LocalDate.of(DateTimeUtils.getYear(endDate), DateTimeUtils.getMonth(endDate), DateTimeUtils.getDay(endDate));
+        logger.error("startDatetmp" + startDatetmp);
+        logger.error("endDatetmp" + endDatetmp);
+        Period period = Period.between(startDatetmp, endDatetmp);
+        logger.error("period" + period);
+        int months = period.getMonths();
+        logger.error("months" + months);
+        return months;
+    }
+
+    public Date getlengthOfMonth(Date date) throws ParseException {
+        logger.error("getlengthOfMonth—date" + date);
+        LocalDate currentDate = LocalDate.of(DateTimeUtils.getYear(date), DateTimeUtils.getMonth(date), DateTimeUtils.getDay(date));
+        logger.error("getlengthOfMonth—date" + currentDate);
+        int lastDay = currentDate.lengthOfMonth();
+        logger.error("getlengthOfMonth—lastDay" + lastDay);
+        String tempDate = DateTimeUtils.getYear(date) + "-" + DateTimeUtils.getMonth(date) + "-" + lastDay;
+        logger.error("getlengthOfMonth—tempDate" + tempDate);
+        return DateTimeUtils.parseDate(tempDate);
+    }
+
+    public long getDaysBetweenDates(Date start, Date end) {
+        Calendar cal = Calendar.getInstance();
+        cal.setTime(start);
+        long startTime = cal.getTimeInMillis();
+        cal.setTime(end);
+        long endTime = cal.getTimeInMillis();
+        long diff = Math.abs(endTime - startTime);
+        return diff / 86400000L;
+    }
+
+    public static HashSet<String> getMonthBetweenDate(Date startTime, Date endTime) {
+        HashSet<String> list = new HashSet();
+
+        for(Calendar calendar = Calendar.getInstance(); startTime.getTime() <= endTime.getTime(); startTime = calendar.getTime()) {
+            logger.error("getMonthBetweenDate—tempDate" + DateTimeUtils.format(startTime, "yyyy-MM"));
+            list.add(DateTimeUtils.format(startTime, "yyyy-MM"));
+            calendar.setTime(startTime);
+            calendar.add(2, 1);
+        }
+
+        return list;
+    }
+}

+ 0 - 1
GDYSL/src/com/kingdee/shr/compensation/app/integrate/BatchSubmitSchemeBillControllerBeanExt.java

@@ -14,7 +14,6 @@ import com.kingdee.eas.base.core.util.EmptyUtil;
 import com.kingdee.eas.common.EASBizException;
 import com.kingdee.eas.framework.CoreBaseInfo;
 import com.kingdee.eas.util.app.DbUtil;
-import com.kingdee.shr.cmpdesign.web.handler.BatchAdjustSalaryEntryGridHandler;
 import com.kingdee.shr.compensation.util.integrate.CmpIntegrateSqlUtils;
 import com.kingdee.shr.compensation.util.integrate.CmpIntegrateUtilsNew;
 import com.kingdee.util.NumericExceptionSubItem;