diff --git a/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/task/UserTaskImpl.java b/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/task/UserTaskImpl.java index 6c26359..9da365c 100644 --- a/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/task/UserTaskImpl.java +++ b/shkd-cosmic-debug/src/main/java/shkd/cosmic/cxkg/task/UserTaskImpl.java @@ -13,6 +13,7 @@ import kd.bos.permission.model.UserParam; import kd.bos.schedule.executor.AbstractTask; import kd.bos.service.ServiceFactory; +import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper; @@ -112,7 +113,7 @@ public class UserTaskImpl extends AbstractTask { "id,number,shkd_oaid", null);//查询星瀚系统部门集合 userIds = new HashMap();//存放系统中已经存在的用户id集合 for (DynamicObject queryUser : queryUsers) { - userIds.put(queryUser.getString("number"), queryUser.getLong("id"));//存放已经存在的人员的id以及number + userIds.put(queryUser.getString("shkd_oaid"), queryUser.getLong("id"));//存放已经存在的人员的id以及number } for (int i = 1; i < pageNumber.intValue(); i++){//查询成功取第一轮数据同步 CURPAGE = i ; @@ -151,7 +152,7 @@ public class UserTaskImpl extends AbstractTask { for (int i = 0; i < dataList.size(); i++) { UserParam user = new UserParam(); JSONObject userData = dataList.getJSONObject(i); - Long workid = userIds.get(userData.getString("workcode")); + Long workid = userIds.get(userData.getString("id")); if (workid != null){ user.setId(workid); user.setCustomUserId(workid); @@ -170,29 +171,29 @@ public class UserTaskImpl extends AbstractTask { // 职位分录 if(workid == null){//若人不存在则更新部门 - List> posList = new ArrayList<>(); - Map entryentity = new HashMap<>(); - // 通过编码设置部门 - Map dptNumMap = new HashMap<>(); - dptNumMap.put("number", userData.getString("departmentcode")); - entryentity.put("dpt",dptNumMap ); // 部门 - entryentity.put("position", userData.getString("jobactivityname")); // 职位 - entryentity.put("isincharge", false); //负责人 - entryentity.put("ispartjob", false); //兼职 - String managerId_oa = userData.getString("managerid");//获取上级人员id(oa) - Long managerId = userIds.get(managerId_oa);//直接上级id - if (managerId != null){ - entryentity.put("superior", managerId); // 赋值直接上级 - }else { - if (!"".equals(managerId_oa)){//当上级人员id(oa)存在且未在星瀚系统检索成功时,修改参数flag,接口将重新构造人员类更新数据 - flag = true; - } - } - entryentity.put("seq", 1); - posList.add(entryentity); - dataMap.put("entryentity", posList); - } + } + List> posList = new ArrayList<>(); + Map entryentity = new HashMap<>(); + // 通过编码设置部门 + Map dptNumMap = new HashMap<>(); + dptNumMap.put("number", userData.getString("departmentcode")); + entryentity.put("dpt",dptNumMap ); // 部门 + entryentity.put("position", userData.getString("jobactivityname")); // 职位 + entryentity.put("isincharge", false); //负责人 + entryentity.put("ispartjob", false); //兼职 + String managerId_oa = userData.getString("managerid");//获取上级人员id(oa) + Long managerId = userIds.get(managerId_oa);//直接上级id + if (managerId != null){ + entryentity.put("superior", managerId); // 赋值直接上级 + }else { + if (!"".equals(managerId_oa)){//当上级人员id(oa)存在且未在星瀚系统检索成功时,修改参数flag,接口将重新构造人员类更新数据 + flag = true; + } + } + entryentity.put("seq", 1); + posList.add(entryentity); + dataMap.put("entryentity", posList); user.setDataMap(dataMap); paramList.add(user); } diff --git a/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/DailyLoanBillFormPlugin.java b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/DailyLoanBillFormPlugin.java new file mode 100644 index 0000000..d18634b --- /dev/null +++ b/shkd-cosmic-debug/src/main/java/shkd/fi/er/plugin/formplugin/DailyLoanBillFormPlugin.java @@ -0,0 +1,63 @@ +package shkd.fi.er.plugin.formplugin; + +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.form.control.Label; +import kd.bos.form.plugin.AbstractFormPlugin; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.sdk.plugin.Plugin; + +import java.math.BigDecimal; +import java.util.EventObject; + +/** + * 员工借款单(借款单)表单插件 + */ +public class DailyLoanBillFormPlugin extends AbstractFormPlugin implements Plugin { + + /** + * 打开界面加载数据 + * 计算部门可用借款额度 + * @param e + */ + @Override + public void afterBindData(EventObject e) { + super.afterBindData(e); + DynamicObject dataEntity = this.getModel().getDataEntity(); + DynamicObject org = dataEntity.getDynamicObject("org");//获取当前部门 + if (org != null){//当部门不为空,开始核算该部门借款可用额度 + //1、获取本位币别 + DynamicObject currency = dataEntity.getDynamicObject("currency");//本位币别 + String sign = currency.getString("sign"); + //设置货币符号 + Label shkd_label_sign = this.getView().getControl("shkd_label_sign"); + shkd_label_sign.setText(sign); + //2、计算借款可用额度 + BigDecimal bigDecimal = new BigDecimal(0); + //查询审批未放款的当前部门的数据(已提交、审核中、审核通过、等待放款) + QFilter qf = new QFilter("billstatus", QCP.in, new String[]{"B", "C", "E", "F"}); + DynamicObject[] bills = BusinessDataServiceHelper.load("er_dailyloanbill", "id.number,loanamount,balanceamount", qf.toArray()); + for (DynamicObject bill : bills) { + BigDecimal loanamount = bill.getBigDecimal("loanamount");//获取借款金额 + bigDecimal = bigDecimal.add(loanamount); + } + //查询审批已放款的当前部门的数据(已付款) + QFilter aqf = new QFilter("billstatus", QCP.in, new String[]{"G"}); + DynamicObject[] abills = BusinessDataServiceHelper.load("er_dailyloanbill", "id.number,loanamount,balanceamount", aqf.toArray()); + for (DynamicObject abill : abills) { + BigDecimal balanceamount = abill.getBigDecimal("balanceamount");//获取待还款金额 + bigDecimal = bigDecimal.add(balanceamount); + } + //设置可借款金额 + Label shkd_borrowloanamount = this.getView().getControl("shkd_borrowloanamount"); + BigDecimal bigDecimal1 = new BigDecimal(300000); + BigDecimal subtract = bigDecimal1.subtract(bigDecimal); + subtract = subtract.setScale(2); + shkd_borrowloanamount.setText(subtract.toString()); + }else { + //隐藏该部分标签数据 :借款可用额度、货币符号、0.00 + this.getView().setVisible(false, new String[]{"shkd_borrowloan", "shkd_label_sign", "shkd_borrowloanamount"}); + } + } +} \ No newline at end of file