一。

二次研发,实现新需求

个人相关==》已办任务==》新加两个结束按钮

杂记二

TFmcWfPersontask_SqlMap.xml文件下

<!-- 查询个人已完成的任务列表 -->
    <select id="selectCompleteTasksWithPersonal" resultMap="billWorkFlow.queryTaskAgentMap">
                 SELECT
              MM.MID,
              MM.BILLNO,
              MM.CREATERID,
              MM.NAME,      
              MM.TASKID,
              MM.COMPLETETIME,
              MM.EXECID,
              MM.NODEID,
              MM.NODENAME,
              MM.PROCESSID,
              MM.PROCESSNAME,
              MM.CORPID,
              MM.PROCESSINST,
              MM.TYPEID,
              MM.OWNER,
              MM.ASSIGNEE,
              MM.loginName,
              MM.DEPTNAME,
              MM.AMOUNT, 
              MM.CREATETIME, 
              MM.billName,
              MM.showType,
              MM.attachmentCount,
              MM.remark,
              MM.TASKSOURCE,
              MM.memo
        FROM
          ( SELECT M.ID AS mId,
                M.BILLNO AS billNo,
                M.CREATER CREATERID,
                E.NAME AS name,
                R.TASKID AS taskId,
                TO_CHAR(R.COMPLETETIME, 'yyyy-MM-dd HH24:mi:ss') AS completeTime,
                R.Executionid as execId,
                A.SHOWTYPE as nodeName,
                R.PROCESSDEFINITIONID AS processId,
                B.PROCESSNAME AS processName,
                M.CORPID AS corpId,
                R.PROCESSINSTANCEID AS processInst,
                M.BILLTYPE AS typeId,
                R.OWNER,
                R.ASSIGNEE,
                #{assignee} loginName,
                M.CREATERDEPT AS deptName,
                R.NODEID as nodeId,
                TO_CHAR(M.originalcurrencysum,'FM99999999990.0099') AS amount,  
                TO_CHAR(R.CREATETIME, 'yyyy-MM-dd HH24:mi:ss') AS createTime, 
                BI.BILLNAME AS billName ,
                A.SHOWTYPE AS showType,
                nvl(M.attachmentCount, 0) as attachmentCount,
                M.remark,
                R.TASKSOURCE,
                M.REMARK MEMO
                FROM T_FMC_BILL_MAINDATA M
                LEFT JOIN T_FMC_WF_PERSONTASK R ON M.BILLNO = R.BUSINESSKEY
                LEFT JOIN T_FMC_SYS_EMPLOYEE E ON E.ID = M.CREATER
                LEFT JOIN T_FMC_WF_ATTRBUT A ON A.NODEID = R.NODEID  AND A.PROCESSDEFINITIONID  = R.PROCESSDEFINITIONID
                LEFT JOIN T_FMC_WF_BASEMESSAGE B ON B.PROCESSDEFINITIONID = R.PROCESSDEFINITIONID
                LEFT JOIN T_FMC_BILL_BILLINFO BI ON BI.ID = M.BILLTYPE
                WHERE R.STATUS != 'active' AND NVL(R.ISJUMP, '1') != '0'
                AND (R.ASSIGNEE = #{assignee} OR R.OWNER=#{assignee})
                AND M.CORPID = #{corpId}
<!--                 AND R.COMPLETETIME = ( -->
<!--                     SELECT MAX(PK.COMPLETETIME) FROM T_FMC_WF_PERSONTASK PK  -->
<!--                     WHERE PK.NODEID = R.NODEID AND PK.PROCESSDEFINITIONID = R.PROCESSDEFINITIONID -->
<!--                     AND PK.BUSINESSKEY = R.BUSINESSKEY -->
<!--                     ) -->
                AND NOT EXISTS (SELECT 1 FROM T_FMC_WF_PERSONTASK K WHERE K.NODEID = R.NODEID AND K.PROCESSDEFINITIONID = R.PROCESSDEFINITIONID
                    AND K.BUSINESSKEY = R.BUSINESSKEY AND K.ASSIGNEE = R.ASSIGNEE AND K.STATUS IN ('active'))
                ) MM 
            <where>        
                <if test="billNo != null and billNo != ''">
                    AND MM.BILLNO LIKE '%'||#{billNo}||'%'
                </if>
                <if test="name != null and name != ''">
                     AND MM.NAME LIKE '%'||#{name}||'%'
                </if>

【注意#{}内的命名要与前端Ajax中传过来的Context中Map键值对的名称一致】

【前端页面文本框中输入的是字符串,而数据库中AMOUNT字段属于number数据类型,要记得数据类型的转换】
                 <if test="totalAmountMin != null and totalAmountMin != ''">  
                    AND MM.AMOUNT <![CDATA[>=]]> to_number(#{totalAmountMin})
                </if>
                <if test="totalAmountMax != null and totalAmountMax != ''">     
                    AND MM.AMOUNT <![CDATA[<=]]> to_number(#{totalAmountMax})    
                </if>

【注意时间的格式】
                  <if test="createStartTime != null and createEndDate != null">
                    AND TRUNC(TO_DATE(MM.CREATETIME, 'YYYY-MM-DD HH24:MI:SS')) <![CDATA[>=]]> TRUNC(TO_DATE(#{createStartTime, jdbcType=VARCHAR},'YYYY-MM-DD HH24:MI:SS'))
                    AND TRUNC(TO_DATE(MM.CREATETIME, 'YYYY-MM-DD HH24:MI:SS')) <![CDATA[<=]]> TRUNC(TO_DATE(#{createEndDate, jdbcType=VARCHAR},'YYYY-MM-DD HH24:MI:SS'))
                </if>
                <if test="createStartTime != null and createEndDate == null">
                    AND TRUNC(TO_DATE(MM.CREATETIME, 'YYYY-MM-DD HH24:MI:SS')) <![CDATA[>=]]> TRUNC(TO_DATE(#{createStartTime, jdbcType=VARCHAR},'YYYY-MM-DD HH24:MI:SS'))
                </if>
                <if test="createStartTime == null and createEndDate != null">
                    AND TRUNC(TO_DATE(MM.CREATETIME, 'YYYY-MM-DD HH24:MI:SS')) <![CDATA[<=]]> TRUNC(TO_DATE(#{createEndDate, jdbcType=VARCHAR},'YYYY-MM-DD HH24:MI:SS'))
                </if>  

                 <if test="billName != null and billName != ''">
                     AND MM.billName LIKE '%'||#{billName}||'%'
                 </if>
                 <if test="showType != null and showType != ''">
                     AND MM.showType LIKE '%'||#{showType}||'%'
                 </if>
                 <if test="memo != null and memo != ''">
                     AND MM.MEMO LIKE '%'||#{memo}||'%'
                 </if>

【注意:where标签放在order by 的前面】
                 </where>
            <if test="orderByCause != null and orderByCause != ''">
                ORDER BY ${orderByCause}
            </if>
            <if test="orderByCause == null or orderByCause == ''">
                ORDER BY MM.COMPLETETIME DESC
            </if> 
    </select>

二。

二次研发,实现新需求【【因为好多方法是封装好的模板,在各个地方会存在多次调用,所以最好不要去改,而是仿照着方法模板,自己另外写出新的具体方法来实现具体的功能】

付管理==》网银支付==》导出

杂记二

1)action.xml 文件中

<!-- 资金网银支付信息导出-->
    <action id="exportPaymentPay" template="simpleTemplate" interceptors="defaultInterceptors">
        <sjmservices>
            <sjmservice id="action1" ref="paymentBaseService" operations="exportPaymentFundPayList"></sjmservice>
        </sjmservices>
    </action>

2)Service.java

/** ******************** 网银支付列表导出 begin**************************************************************************************************** **/
    /**
     * 功能:网银支付列表导出
     * @Title: exportPaymentFundPayList
     * @Description:
     * @param
     * @return void 
     * @author zhulong
     * @throws Exception 
     * @date 2018年2月6日
     */
    public void exportPaymentFundPayList(Context context) throws Exception {
        try {
            /**查询结果集**/
             List<Map<String, Object>> paymentFundPayList = new ArrayList<Map<String,Object>>();
             /**查询条件**/
             Map<String, Object> conditionMap = new HashMap<String, Object>();
             conditionMap.put("corpId", this.getUserInfo().getCorpid());
             conditionMap.put("empId", this.getUserInfo().getEmployeeId());
             //根据查询条件导出(跟当前查询数据一致)
            conditionMap.putAll(context.getDataMap());

【这部分的SQL语句还是使用原来系统中自带的,数据库中所查询出来的数据记录数有30条,而在前端页面中所显示出来的数据的记录数只有10条,其中,涉及到了用户的权限,不同的用户den导登录系统后所能够查看到的信息是不一样的。导出到Excel中的记录数应该要和前端页面中所显示的保持一致,】
           paymentFundPayList = sqlMap.queryForList("PaymentSqlMap.qryPaymentFundPayData", conditionMap);
            //导出的文件名
            String fileName = "中国农业银行离线制单导入文件.xls";
            //农业银行离线导出文件的实现方法
            Workbook workbook = ExportExcelUtil.exportAgribank(fileName, paymentFundPayList);
             /** 获得response对象**/
             HttpServletResponse response = (HttpServletResponse) context.getChannelContext().getResponse();
             /** 设置编码格式**/
             response.setCharacterEncoding("UTF-8");
            response.setContentType("application/x-download");
             fileName = URLEncoder.encode(fileName, "UTF-8");
             response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
             /** 流输出**/
             OutputStream out = response.getOutputStream();
             workbook.write(out);
             out.close();
             
             //导出Excel文件之后修改查询结果中的发送时间字段和支付状态字段,支付状态字段设置成   6付款中 
             for(int i=0;i<paymentFundPayList.size();i++){
                 Map<String, Object> paymentMap = paymentFundPayList.get(i);
                 String fundId =(String)paymentMap.get("id");//此为fundId
                 //String batchNo =(String)paymentMap.get("batchNo");
                 Map<String, Object> paraMap = new HashMap<String, Object>();
                 paraMap.put("corpId", this.getUserInfo().getCorpid());
                 paraMap.put("fundId", fundId);
                 sqlMap.update("PaymentSqlMap.updatePaymentStatusAsInPayAgribank", paraMap);
             }
     
        } catch (Exception e) {
            throw e;
        }
    }

【这个表头对应的Map键值对没有使用】

     private LinkedHashMap<String, String> getTitles() {

        LinkedHashMap<String, String> titles = new LinkedHashMap<String, String>();
        titles.put("billNo", "单据编号");
        titles.put("billName", "单据名称");
        titles.put("reqOrgName", "机构名称");
        titles.put("recAccountNo", "收款方账号");
        titles.put("recAccountName", "收款方户名");
        titles.put("recBankName", "收款行名称");
        titles.put("bankPayType", "公私标识");
        titles.put("amount", "金额(元)");
        titles.put("pushDate", "发送时间");
        titles.put("payDate", "付款时间");
        titles.put("payStatus_name", "支付状态");
        titles.put("payMethod", "支付方式");
        return titles;
    }
    
/** ******************** 网银支付列表导出end **************************************************************************************************** **/
    ExportExcelUtil.java

exportAgribank方法的具体实现:

    /** ******************** 网银支付列表导出农业银行离线文件Begin **************************************************************************************************** **/

    public static Workbook exportAgribank(String fileName, List<Map<String, Object>> paymentFundPayList) {
        return exportAgribank(fileName, paymentFundPayList, "yyyy-MM-dd HH:mm:ss");
    }
    
    public static Workbook exportAgribank(String fileName, List<Map<String, Object>> paymentFundPayList, String pattern) {
        // 第一步,创建一个workbook,对应一个Excel文件  
        Workbook workbook = ExcelFileUtil.getFormatWorkbook(fileName);
        
        // 第二步,在webbook中添加一个sheet,对应Excel文件中的sheet 
        int indexDot = fileName.indexOf('.');
        String sheetName = indexDot == -1 ? fileName : fileName.substring(0, indexDot);
        Sheet sheet = workbook.createSheet(sheetName);
        
        // 第三步,创建标题行一
        //定义格式
        CellStyle cellStyle = workbook.createCellStyle();
        cellStyle.setAlignment(XSSFCellStyle.ALIGN_CENTER);
        cellStyle.setVerticalAlignment(XSSFCellStyle.VERTICAL_CENTER);
        Row row0 = sheet.createRow(0);
        row0.createCell(5).setCellValue("中国农业银行离线制单导入文件");
        
        // 第四步,创建标题行二
        Row row1 = sheet.createRow(1);
        row1.createCell(0).setCellValue("编号");
        row1.createCell(1).setCellValue("付款方账户类型");
        row1.createCell(2).setCellValue("付款方账号");
        row1.createCell(3).setCellValue("收款方账号");
        row1.createCell(4).setCellValue("收款方户名");
        row1.createCell(5).setCellValue("是否农行账户");
        row1.createCell(6).setCellValue("开户银行(行别)");
        row1.createCell(7).setCellValue("开户大额行号");
        row1.createCell(8).setCellValue("开户行支行名称");
        row1.createCell(9).setCellValue("金额");
        row1.createCell(10).setCellValue("预约日期");
        row1.createCell(11).setCellValue("用途(附言)");
        
        // 第五步,创建数据行
        Row row2 = sheet.createRow(2);
        int i = 1;
        if(paymentFundPayList != null) {
            SimpleDateFormat sdf = new SimpleDateFormat(pattern);
            for(Map<String, Object> data : paymentFundPayList) {
                row2 = sheet.createRow(++i);
                
                Cell cell0 = row2.createCell(0);//第一列
                Object value0 = data.get("billNo");
                if(value0 != null) {
                    if (value0 instanceof Double) {
                        cell0.setCellValue((Double)value0);
                    } else if (value0 instanceof Date) {
                        cell0.setCellValue(sdf.format((Date)value0));
                    } else {
                        cell0.setCellValue(value0.toString());
                    }    
                }    
                Cell cell1 = row2.createCell(1); //第二列cell1 为下拉框
                cell1.setCellValue("1"); //默认值
                String[] textlist = { "0", "1", "2", "3"};  
                //设置第二列的1~最后一行 为下拉列表
                 CellRangeAddressList regions = new CellRangeAddressList(2, paymentFundPayList.size()+1, 1, 1);
                 //创建下拉列表数据
                 DVConstraint constraint = DVConstraint.createExplicitListConstraint(textlist);
                 //绑定
                 HSSFDataValidation dataValidation = new HSSFDataValidation(regions, constraint);
                 sheet.addValidationData(dataValidation);
                 
                Cell cell2 = row2.createCell(2);//第三列付款方账户
                 Object value2 = data.get("payAccountNo");
                if(value2 == null){
                    cell2.setCellValue("34646001040004242");//默认值
                }else {
                    if (value2 instanceof Double) {
                        cell2.setCellValue((Double)value2);
                    } else if (value2 instanceof Date) {
                        cell2.setCellValue(sdf.format((Date)value2));
                    } else {
                        cell2.setCellValue(value2.toString());
                    }    
                }    
                
                Cell cell3 = row2.createCell(3);//第四列收款方账户
                Object value3 = data.get("recAccountNo");
                if(value3 != null) {
                    if (value3 instanceof Double) {
                        cell3.setCellValue((Double)value3);
                    } else if (value3 instanceof Date) {
                        cell3.setCellValue(sdf.format((Date)value3));
                    } else {
                        cell3.setCellValue(value3.toString());
                    }    
                }    
                Cell cell4 = row2.createCell(4);//第五列收款方姓名
                Object value4 = data.get("recAccountName");
                if(value4 != null) {
                    if (value4 instanceof Double) {
                        cell4.setCellValue((Double)value4);
                    } else if (value4 instanceof Date) {
                        cell4.setCellValue(sdf.format((Date)value4));
                    } else {
                        cell4.setCellValue(value4.toString());
                    }    
                }    
                Cell cell5 = row2.createCell(5); 
                Object value5 = data.get("recBankName");//加判断
                String v5 = value5.toString();
                if(v5 != null) {
                    if (v5.indexOf("农行")!=-1 || v5.indexOf("农业银行")!=-1 || v5.indexOf("中国农业银行")!=-1){
                         //"只要test.indexOf('This')返回的值不是-1说明test字符串中包含字符串'农行',相反如果包含返回的值必定是-1"
                        cell5.setCellValue("是");
                     }else{
                         cell5.setCellValue("否");
                     }
                 }    
                Cell cell6 = row2.createCell(6); 
                Object value6 = data.get("recBankTypeName"); 
                if(value6 != null) {
                    if (value6 instanceof Double) {
                        cell6.setCellValue((Double)value6);
                    } else if (value6 instanceof Date) {
                        cell6.setCellValue(sdf.format((Date)value6));
                    } else {
                        cell6.setCellValue(value6.toString());
                    }    
                }    
                Cell cell7 = row2.createCell(7); 
                Object value7 = data.get("recBankTypeCode"); 
                if(value7 != null) {
                    if (value7 instanceof Double) {
                        cell7.setCellValue((Double)value7);
                    } else if (value7 instanceof Date) {
                        cell7.setCellValue(sdf.format((Date)value7));
                    } else {
                        cell7.setCellValue(value7.toString());
                    }    
                }    
                Cell cell8 = row2.createCell(8); 
                Object value8 = data.get("recBankName");
                if(value8 != null) {
                    if (value8 instanceof Double) {
                        cell8.setCellValue((Double)value8);
                    } else if (value8 instanceof Date) {
                        cell8.setCellValue(sdf.format((Date)value8));
                    } else {
                        cell8.setCellValue(value8.toString());
                    }    
                }    
                
                Cell cell9 = row2.createCell(9); 
                Object value9 = data.get("amount");
                if(value9 != null) {
                    if (value9 instanceof Double) {
                        cell9.setCellValue((Double)value9);
                    } else if (value9 instanceof Date) {
                        cell9.setCellValue(sdf.format((Date)value9));
                    } else {
                        cell9.setCellValue(value9.toString());
                    }    
                }
                
                Cell cell10 = row2.createCell(10); 
                Object value10 = data.get("date"); //预约日期 为空
                if(value10 != null) {
                    if (value10 instanceof Double) {
                        cell8.setCellValue((Double)value10);
                    } else if (value10 instanceof Date) {
                        cell10.setCellValue(sdf.format((Date)value10));
                    } else {
                        cell10.setCellValue(value10.toString());
                    }    
                }
                
                Cell cell11 = row2.createCell(11); 
                Object value11 = data.get("porpose");
                if(value11 != null) {
                    if (value11 instanceof Double) {
                        cell11.setCellValue((Double)value11);
                    } else if (value11 instanceof Date) {
                        cell11.setCellValue(sdf.format((Date)value11));
                    } else {
                        cell11.setCellValue(value11.toString());
                    }    
                }
                
            }
        }
        return workbook;
    }
    
/** ******************** 网银支付列表导出农业银行离线文件end **************************************************************************************************** **/
3)SqlMap.xml

  <!-- 导出农行离线文件之后,修改支付状态为“6 付款中” -->
    <update id="updatePaymentStatusAsInPayAgribank" parameterType="Map">
        BEGIN
            -- 更新付款表T_FMC_FUND_PAYMENT付款状态为“支付中”
            UPDATE T_FMC_FUND_PAYMENT PF
               SET PF.PAYSTATUS = '6', PF.PUSHDATE = SYSDATE
             WHERE PF.CORPID = #{corpId}
                AND PF.ID = #{fundId, jdbcType=VARCHAR};
               
            -- 更新支付表付款状态为“支付中”
            UPDATE T_FMC_BILL_PAYMENT BP
               SET BP.PAYSTATUS = '6'
             WHERE BP.CORPID = #{corpId}
               AND BP.ID IN (SELECT PF.PAYMENTID FROM T_FMC_FUND_PAYMENT PF 
                                 WHERE  PF.ID = #{fundId, jdbcType=VARCHAR});
                                    
            -- 更新主表支付状态为“支付中”
            UPDATE T_FMC_BILL_MAINDATA BM
                SET BM.BILLSTATUS='6' 
               WHERE BM.ID IN (SELECT PF.MAINID
                                  FROM T_FMC_FUND_PAYMENT PF
                               WHERE  PF.ID = #{fundId, jdbcType = VARCHAR});
        END;
    </update>

4)配置Service

    <!-- 支付 -->
    <sjmservice id="paymentBaseService" class="com.stream.wsInterface.base.payment.PaymentBaseService">
        <x:property name="fundServer" value="${wsInterface.payment.fund}"></x:property>
        <x:property name="onlineServer" value="${wsInterface.payment.online}"></x:property>
    </sjmservice>

三。

二次研发,新需求

杂记二

1)action.xml

    <!-- 取消支付 -->
    <action id="paymentCancel" template="simpleTemplate" interceptors="defaultInterceptors">
        <sjmservices>
            <sjmservice id="action1" ref="paymentBaseService" operations="paymentCancel"></sjmservice>
        </sjmservices>
    </action>

2)Service.java,添加方法

    /**
     * 取消支付
     * @param ctx
     */
    public void paymentCancel(Context context) {
        logger.debug("取消支付开始...请求参数为:" + context.getDataMap());
        try{
             /** 封装查询参数 **/
            Map<String, Object> paraMap = context.getDataMap();
            paraMap.put("corpId", this.getUserInfo().getCorpid());   

【前端会通过Context传递一个和勾选对应的ids,这个ids 的数据类型是一个字符串,将其拆分成字符串数组】

          String[] ids = context.getData("ids").toString().split(",");
               for(int i = 0;i<ids.length;i++) {
                 paraMap.put("fundId", ids[i]);
                sqlMap.update("PaymentSqlMap.updatePaymentStatusAsWaitfor", paraMap);
            }
         } catch(Exception e) {
            throw new WsInterfaceModuleException("取消支付失败!", e);
        }
        logger.debug("取消支付结束...");
    }

3)SqlMap.xml

  <!-- 点击取消支付后,修改支付状态为“1 待处理” -->
    <update id="updatePaymentStatusAsWaitfor" parameterType="Map">
        BEGIN
            -- 更新付款表T_FMC_FUND_PAYMENT付款状态为“待处理”
            UPDATE T_FMC_FUND_PAYMENT PF
               SET PF.PAYSTATUS = '1'
             WHERE PF.CORPID = #{corpId}
                AND PF.ID = #{fundId, jdbcType=VARCHAR};
               
            -- 更新支付表付款状态为“待处理”
            UPDATE T_FMC_BILL_PAYMENT BP
               SET BP.PAYSTATUS = '1'
             WHERE BP.CORPID = #{corpId}
               AND BP.ID IN (SELECT PF.PAYMENTID FROM T_FMC_FUND_PAYMENT PF 
                                 WHERE  PF.ID = #{fundId, jdbcType=VARCHAR});
                                    
            -- 更新主表支付状态为“待处理”
            UPDATE T_FMC_BILL_MAINDATA BM
                SET BM.BILLSTATUS='1' 
               WHERE BM.ID IN (SELECT PF.MAINID
                                  FROM T_FMC_FUND_PAYMENT PF
                               WHERE  PF.ID = #{fundId, jdbcType = VARCHAR});
        END;
    </update>

4)配置Service

    <!-- 支付 -->
    <sjmservice id="paymentBaseService" class="com.stream.wsInterface.base.payment.PaymentBaseService">
        <x:property name="fundServer" value="${wsInterface.payment.fund}"></x:property>
        <x:property name="onlineServer" value="${wsInterface.payment.online}"></x:property>
    </sjmservice>

 

四。

杂记二

1)list.html 中:

<!--淇敼瀵嗙爜鍜岄噸缃瘑鐮佺殑鍔熻兘娣诲姞
                2018/07/25-->
            <button type="button" class="btn btn-default" id="employee_password_mod">修改密码</button>
            <button type="button" class="btn btn-default" id="employee_password_reset">重置密码</button>

2)list.js 中

    /**
     * 修改密码
     * 2018/07/23
     */
    $("#employee_password_mod").click(function () {
            var checked_elem = $("tbody :checkbox:checked", employee_table_example);
            if (checked_elem.length <= 0) {
                utils.fmc_message("请选择一条记录。");
                return false;
            } else if (checked_elem.length > 1) {
                utils.fmc_message("一次只能修改一条记录。");
                return false;
            } 
            
            var selected_data = table.row(checked_elem.closest("tr")[0]).data();
            $("#id2").val(selected_data.id);
            $("#operation").val("modifyPass");
            $("#password").val("");
            $("#conformpass").val("");
            $(".modal-title", m_operate).html("修改用户密码");
            initControls();
            m_operate.modal("show");
    });
    
    // 重置密码
    $("#employee_password_reset").click(function () {
        var checked_elem = $("tbody :checkbox:checked", employee_table_example);
        if (checked_elem.length <= 0) {
            utils.fmc_message("请选择一条记录。");
            return false;
        } else if (checked_elem.length > 1) {
            utils.fmc_message("一次只能重置一条记录。");
            return false;
        } 
        if (checkChecked_elem()) {
            utils.fmc_alert("确定要执行删除操作吗?", function () {
                var selected_data = table.row(checked_elem.closest("tr")[0]).data();
                var id=selected_data.id;
                 utils.ajax({
                     url: "resetEmployeePassword.ajax",
                     type: "POST",
                     data:{"id":id}, 
                     dataType: "json",
                     success: function(data){
                         if (data != null) {
                             utils.fmc_message(data);
                             table.draw();
                         }
                     },
                     show_time: 30000
                 });
            });
        }    
    });

3)   jstream-action-system.xml 文件中

<!-- 修改用户密码
         2018/07/23 -->
    <action id="updatepassInfo" template="simpleTemplate" interceptors="defaultInterceptors">
        <sjmservices>
            <sjmservice id="action1" ref="employeeService" operations="updateEmployeePassInfo"></sjmservice>
        </sjmservices>
    </action>
    
    <!--重置密码
        2018/07/23 -->
    <action id="resetEmployeePassword" template="simpleTemplate" interceptors="defaultInterceptors">
        <sjmservices>
            <sjmservice id="action1" ref="employeeService" operations="resetEmployeePassword"></sjmservice>
        </sjmservices>
    </action>

4)EmployeeService.java 中

    /**
     * 修改密码
     * 2018/07/23
     * @param ctx
     */
    @Tx
    public void updateEmployeePassInfo(Context ctx) {
        try {
            logger.debug("-------------start to updateEmployeePassInfo---------------");
            logger.debug("print request data = [" + ctx.getDataMap().toString() + "]");
            UserInfo userInfo = this.getUserInfo();    // 当前认证用户信息
            setUserInfoToCtx(ctx);
            Map<String,Object> paramMap = ctx.getDataMap();
            
            String pass=ctx.getData("newPass");
            UserMeta userMeta = (UserMeta) userInfo;
            PasswordEncoder passwordEncoder = getPasswordEncoder();
            String password = passwordEncoder.encodePassword(pass,saltSource.getSalt(userMeta));
            String id=ctx.getData("id2");
            paramMap.put("password",password);
            paramMap.put("id",id);
            // 执行更新操作
             int count = sqlMap.update("rbac.account.updatePasswordInfo", paramMap);
                     
             if(count > 0) {
                 this.success(ctx, "操作成功!");
             } else {
                 this.success(ctx, "操作失败!");
             }
        } catch (DataAccessException e) {
            throw new SysModuleException(SysModuleErrorCode.UPDATE_EMPLOYEE, e);
        } catch (SysModuleException e1) {//执行公共查询方法失败
            throw e1;
        } catch (Exception e) {
            throw new SysModuleException(SysModuleErrorCode.UPDATE_EMPLOYEE, e);
        } finally {
            logger.debug("-----------updateEmployeeInfo end-----------");
        }
    }
    private PasswordEncoder getPasswordEncoder() {
        return ConnectionRegistry.REGISTER.getSpecialSingleton(PasswordEncoder.class);
    }
    /*
     * 重置密码
     * 2018/07/23
     */
    public void resetEmployeePassword(Context ctx){
        logger.debug("-------------start to updateEmployeePassword---------------");
        logger.debug("print request data = [" + ctx.getDataMap().toString());
        try {
            UserInfo userInfo = this.getUserInfo();    // 当前认证用户信息
            
            // 获得前端工作组信息
            Map<String, Object> valueMap = ctx.getDataMap();
            String id=ctx.getData("id");
            valueMap.put("username", userInfo.getUsername());
            UserMeta userMeta = (UserMeta) userInfo;
            PasswordEncoder passwordEncoder = getPasswordEncoder();
            String password = passwordEncoder.encodePassword("123456",saltSource.getSalt(userMeta));
            valueMap.put("password", password);
            // 执行更新操作
            int count = sqlMap.update("rbac.account.updatePasswordInfo", valueMap);
            
            if(count > 0) {
                this.success(ctx, "重置操作成功!");
            } else {
                this.success(ctx, "重置操作失败!");
            }
        } catch(Exception e) {
            throw new SscModuleException(SscModuleErrorCode.SSC_UPDATESSCWORKGROUP_ERROR_CODE, "重置失败!");
        }
    }

5)修改密码和重置密码,在 *sqlMap.xml 中 使用了同一个SQL语句

    <!--根据Id修改密码-->
     <update id="updatePasswordInfo" parameterType="Map"> 
         UPDATE
        <include refid="TableName"/>
        SET PASSWORD=#{password} WHERE ID=(select accountid from t_fmc_sys_employee where id=#{id})
    </update>

6)配置Service,在jstream-sjmservice-system.xml

    <!-- 用户管理 -->
    <sjmservice id="employeeService" class="com.stream.system.EmployeeService">
           <x:property name="fromAddress" value="${fromAddress}"></x:property>
        <x:property name="password" value="${password}"></x:property>
        <x:property name="subject" value="${subject}"></x:property>
        <x:property name="userName" value="${userName}"></x:property>
    </sjmservice>

杂记二

五。借款区金额=主表区金额

 

 

六。导出

 

 

七。

 

 

八。

杂记二

public class CustomProvisioningImpl extends AuthorityProvisionningAdapter implements InitializingBean , ApplicationContextAware {

 

 

 

-----------------------------------------------  我是低调的分隔线  -----------------------------------------------

 

杂记二

 

 

相关文章: