|
@@ -1,567 +0,0 @@
|
|
-package nc.ui.wa.paydata.action;
|
|
|
|
-
|
|
|
|
-import java.awt.event.ActionEvent;
|
|
|
|
-import java.io.BufferedReader;
|
|
|
|
-import java.io.InputStreamReader;
|
|
|
|
-import java.io.OutputStream;
|
|
|
|
-import java.net.HttpURLConnection;
|
|
|
|
-import java.net.URL;
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
-import nc.bs.framework.common.NCLocator;
|
|
|
|
-import nc.bs.hr.gy_zsgl.plugin.Base64Util;
|
|
|
|
-import nc.bs.hr.gy_zsgl.plugin.MD5Util;
|
|
|
|
-import nc.bs.hr.gy_zsgl.plugin.SmsRequest;
|
|
|
|
-import nc.bs.hr.gy_zsgl.plugin.SmsResponse;
|
|
|
|
-import nc.itf.bd.psn.psndoc.IPsndocQueryService;
|
|
|
|
-import nc.itf.uap.IUAPQueryBS;
|
|
|
|
-import nc.jdbc.framework.processor.ArrayListProcessor;
|
|
|
|
-import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
|
-import nc.pub.templet.converter.util.helper.ExceptionUtils;
|
|
|
|
-import nc.ui.pub.beans.MessageDialog;
|
|
|
|
-import nc.ui.uif2.model.AbstractUIAppModel;
|
|
|
|
-import nc.ui.wa.paydata.model.PaydataModelDataManager;
|
|
|
|
-import nc.ui.wa.paydata.view.PaydataInfoEditor;
|
|
|
|
-import nc.ui.wa.pub.WaOrgHeadPanel;
|
|
|
|
-import nc.vo.bd.psn.PsndocVO;
|
|
|
|
-import nc.vo.jcom.lang.StringUtil;
|
|
|
|
-import nc.vo.pub.BusinessException;
|
|
|
|
-import nc.vo.pub.lang.UFDouble;
|
|
|
|
-import nc.vo.wa.paydata.DataVO;
|
|
|
|
-
|
|
|
|
-public class SalarySendAction备份 extends PayDataBaseAction{
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 薪资发送按钮
|
|
|
|
- * 发送短信给员工
|
|
|
|
- */
|
|
|
|
- private static final long serialVersionUID = -2837557144503329323L;
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private PaydataInfoEditor editorModel;
|
|
|
|
-
|
|
|
|
- protected AbstractUIAppModel model;
|
|
|
|
-
|
|
|
|
- private WaOrgHeadPanel orgpanel = null;
|
|
|
|
-
|
|
|
|
- private PaydataModelDataManager dataManager = null;
|
|
|
|
-
|
|
|
|
- private String[] parms0103={"岗位工资","效益奖","综合补贴","年功工资","职称补贴","中夜班费","满勤奖",
|
|
|
|
- "加班费","考核奖","安全文明行风奖","房贴","扣款","应得工资","失业","养老","医保","公积金","年金",
|
|
|
|
- "本期税额","会费","互助金","其它扣款","实得工资"};//大众燃气本部工资短信提醒 5f5a313d92a545fe87d95cd1358db1bd
|
|
|
|
-
|
|
|
|
- private String[] parms010304={"岗位工资","效益奖","综合补贴","年功工资","职称补贴","中夜班费","满勤奖",
|
|
|
|
- "加班费","值班费","考核奖","安全文明行风奖","房贴","扣款","应得工资","失业","养老","医保","公积金","年金",
|
|
|
|
- "本期税额","会费","互助金","其它扣款","实得工资"};//南通开发区大众燃气工资短信提醒 de0302949ac443a4be7727b490d7e9ca
|
|
|
|
-
|
|
|
|
- private String[] parms010301={"岗位工资","效益奖","综合补贴","年功工资","职称补贴","中夜班费","满勤奖",
|
|
|
|
- "加班费","考核奖","安全文明行风奖","房贴","扣款","应得工资","失业","养老","医保","公积金","年金",
|
|
|
|
- "本期税额","会费","互助金","其它扣款","实得工资"};//燃气设备公司工资短信提醒 487e12e853fc438bb6d623848a804003
|
|
|
|
-
|
|
|
|
- private String[] parmsNT08={"岗位工资","效益奖","综合补贴","年功工资","职称补贴","满勤奖",
|
|
|
|
- "加班费","安全文明行风奖","房贴","考核奖","行风奖","安全奖","亮点奖","保供奖","高温费","应得工资","失业",
|
|
|
|
- "养老","医保","公积金","会费","互助金","实得工资"};//大众燃气设计室工资短信提醒 1dbbd7070af14a1faa930b9e96d87281
|
|
|
|
-
|
|
|
|
- private String[] parms0103NT05={"劳务费","效益奖","中夜班费","满勤奖","加班费","其它补贴","考核奖","行风奖",
|
|
|
|
- "安全奖","亮点奖","保供奖","高温费","年度效益奖","病事假","应得工资","失业","养老","医保","公积金","会费",
|
|
|
|
- "互助金","实得工资"};//大众燃气本部劳务工资短信提醒 e283141eed90470eb156527d8fd4b4d0
|
|
|
|
-
|
|
|
|
- private String[] parms010302={"岗位工资","效益奖","综合补贴","年功工资","职称补贴","中夜班费","满勤奖",
|
|
|
|
- "加班费","其它补贴","考核奖","安全文明行风奖","房贴","扣款","应得工资","失业","养老","医保","公积金","年金",
|
|
|
|
- "本期税额","会费","互助金","其它扣款","实得工资"};//安装工程公司工资短信提醒 369f9348418f4587a30b74e0fa4fa5d8
|
|
|
|
-
|
|
|
|
- private IUAPQueryBS iuap = null;
|
|
|
|
-
|
|
|
|
- public IUAPQueryBS getIuapBs(){
|
|
|
|
- if(null==iuap){
|
|
|
|
- iuap = (IUAPQueryBS) NCLocator.getInstance().lookup(IUAPQueryBS.class.getName());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return iuap;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private IPsndocQueryService ipsndocqs = null;
|
|
|
|
-
|
|
|
|
- public IPsndocQueryService getIpsndocQueryService(){
|
|
|
|
-
|
|
|
|
- if(null==ipsndocqs){
|
|
|
|
- ipsndocqs = (IPsndocQueryService) NCLocator.getInstance().lookup(IPsndocQueryService.class.getName());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return ipsndocqs;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- //移动发送短信模板接口
|
|
|
|
- final String API_URL="http://112.35.1.155:1992/sms/tmpsubmit";
|
|
|
|
-
|
|
|
|
- public PaydataModelDataManager getDataManager() {
|
|
|
|
- return dataManager;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void setDataManager(PaydataModelDataManager dataManager) {
|
|
|
|
- this.dataManager = dataManager;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public WaOrgHeadPanel getOrgpanel() {
|
|
|
|
- return orgpanel;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void setOrgpanel(WaOrgHeadPanel orgpanel) {
|
|
|
|
- this.orgpanel = orgpanel;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public AbstractUIAppModel getModel() {
|
|
|
|
- return model;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void setModel(AbstractUIAppModel arapBillCardForm) {
|
|
|
|
- this.model = arapBillCardForm;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public PaydataInfoEditor getEditorModel() {
|
|
|
|
- return editorModel;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void setEditorModel(PaydataInfoEditor paydataInfoEditor) {
|
|
|
|
- this.editorModel = paydataInfoEditor;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- public SalarySendAction备份() {
|
|
|
|
- super.setBtnName("薪资发送");
|
|
|
|
- super.setCode("salarysendAction");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public void doAction(ActionEvent e) throws Exception {
|
|
|
|
- String waPeriod = getOrgpanel().getWaPeriodRefPane().getRefPK();
|
|
|
|
- String pkWaclass = getOrgpanel().getWaClassRefPane().getRefPK();
|
|
|
|
- String pkOrg = getOrgpanel().getRefPane().getRefPK();
|
|
|
|
- if(StringUtil.isEmpty(pkOrg)){
|
|
|
|
- ExceptionUtils.wrapException(new Exception("人力资源组织为空,请选择!"));
|
|
|
|
- }else if(StringUtil.isEmpty(pkWaclass)){
|
|
|
|
- ExceptionUtils.wrapException(new Exception("薪资方案为空,请选择!"));
|
|
|
|
- }else if(StringUtil.isEmpty(waPeriod)){
|
|
|
|
- ExceptionUtils.wrapException(new Exception("薪资期间为空,请选择!"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- String value =getSysinntValue();//参数控制短信接收的人,用于前期测试用
|
|
|
|
-
|
|
|
|
- //取年份
|
|
|
|
- String cyear = waPeriod.substring(0, 4);
|
|
|
|
- //取月份
|
|
|
|
- String cperiod = waPeriod.substring(4, 6);
|
|
|
|
-
|
|
|
|
- String ym=cyear+"-"+cperiod;
|
|
|
|
-
|
|
|
|
- List<DataVO> datasvos= getDataManager().getPaydataModel().getData();
|
|
|
|
-
|
|
|
|
- if(null==datasvos || datasvos.size()==0){
|
|
|
|
-
|
|
|
|
- ExceptionUtils.wrapException(new Exception("没有获取到需要发送短信的数据,请检查!"));
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Map<String,PsndocVO> psndocMap= getPsndocvoMap(datasvos);//key:人员主键 value:人员VO
|
|
|
|
-
|
|
|
|
- Map<String,String> classItemMap = getClassItem(pkOrg, pkWaclass, waPeriod);
|
|
|
|
-
|
|
|
|
- for(DataVO datasvo : datasvos){
|
|
|
|
-
|
|
|
|
- String gwgz=classItemMap.get("岗位工资");
|
|
|
|
- String jxj= classItemMap.get("效益奖");
|
|
|
|
- String zhbt=classItemMap.get("综合补贴");
|
|
|
|
- String nggz=classItemMap.get("年功工资");
|
|
|
|
- String zcbw=classItemMap.get("职称补贴");
|
|
|
|
- String zybf=classItemMap.get("中夜班费");
|
|
|
|
- String mqj= classItemMap.get("满勤奖");
|
|
|
|
- String jbf= classItemMap.get("加班费");
|
|
|
|
- String khj= classItemMap.get("考核奖");
|
|
|
|
- String aqwmxfj=classItemMap.get("安全文明行风奖");
|
|
|
|
- String ft= classItemMap.get("房贴");
|
|
|
|
- String kk= classItemMap.get("扣款");
|
|
|
|
- String ydgz=classItemMap.get("应得工资");
|
|
|
|
- String sy= classItemMap.get("失业");
|
|
|
|
- String yl= classItemMap.get("养老");
|
|
|
|
- String yb= classItemMap.get("医保");
|
|
|
|
- String gjj= classItemMap.get("公积金");
|
|
|
|
- String nj= classItemMap.get("年金");
|
|
|
|
- String bqse=classItemMap.get("本期税额");
|
|
|
|
- String hf= classItemMap.get("会费");
|
|
|
|
- String hzj= classItemMap.get("互助金");
|
|
|
|
- String qtkk=classItemMap.get("其它扣款");
|
|
|
|
- String sdgz=classItemMap.get("实得工资");
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- String gwgzcode=new UFDouble(datasvo.getAttributeValue(gwgz).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String jxjcode= new UFDouble(datasvo.getAttributeValue(jxj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String zhbtcode=new UFDouble(datasvo.getAttributeValue(zhbt).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String nggzcode=new UFDouble(datasvo.getAttributeValue(nggz).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String zcbwcode=new UFDouble(datasvo.getAttributeValue(zcbw).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String zybfcode=new UFDouble(datasvo.getAttributeValue(zybf).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String mqjcode= new UFDouble(datasvo.getAttributeValue(mqj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String jbfcode= new UFDouble(datasvo.getAttributeValue(jbf).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String khjcode= new UFDouble(datasvo.getAttributeValue(khj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String aqwmxfjcode=new UFDouble(datasvo.getAttributeValue(aqwmxfj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String ftcode= new UFDouble(datasvo.getAttributeValue(ft).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String kkcode= new UFDouble(datasvo.getAttributeValue(kk).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String ydgzcode=new UFDouble(datasvo.getAttributeValue(ydgz).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String sycode= new UFDouble(datasvo.getAttributeValue(sy).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String ylcode= new UFDouble(datasvo.getAttributeValue(yl).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String ybcode= new UFDouble(datasvo.getAttributeValue(yb).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String gjjcode= new UFDouble(datasvo.getAttributeValue(gjj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String njcode= new UFDouble(datasvo.getAttributeValue(nj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String bqsecode=new UFDouble(datasvo.getAttributeValue(bqse).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String hfcode= new UFDouble(datasvo.getAttributeValue(hf).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String hzjcode= new UFDouble(datasvo.getAttributeValue(hzj).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String qtkkcode=new UFDouble(datasvo.getAttributeValue(qtkk).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
- String sdgzcode=new UFDouble(datasvo.getAttributeValue(sdgz).toString()).setScale(2, UFDouble.ROUND_HALF_UP).toString();
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 准备请求参数
|
|
|
|
- SmsRequest request = new SmsRequest();
|
|
|
|
- request.setEcName("南通大众燃气有限公司");//集团客户名称
|
|
|
|
- request.setApId("yecai");//用户名
|
|
|
|
- request.setSecretKey("Nt_cw968007");//密码
|
|
|
|
- request.setTemplateId("5f5a313d92a545fe87d95cd1358db1bd");//模版ID
|
|
|
|
- String mobile=psndocMap.get(datasvo.getPk_psndoc()).getMobile();
|
|
|
|
- if(null==mobile ||
|
|
|
|
- "".equals(mobile)){
|
|
|
|
- throw new BusinessException("短信发送失败,"+psndocMap.get(datasvo.getPk_psndoc()).getName()+",没有维护手机号!");
|
|
|
|
- }
|
|
|
|
- request.setMobiles(value.length()>0?value:mobile);//手机号码
|
|
|
|
- List<String> params = new ArrayList<String>();
|
|
|
|
- params.add(psndocMap.get(datasvo.getPk_psndoc()).getName());//姓名
|
|
|
|
- params.add(convertToChineseDate(ym));//年月
|
|
|
|
- params.add(gwgzcode); //岗位工资
|
|
|
|
- params.add(jxjcode);
|
|
|
|
- params.add(zhbtcode);
|
|
|
|
- params.add(nggzcode);
|
|
|
|
- params.add(zcbwcode);
|
|
|
|
- params.add(zybfcode);
|
|
|
|
- params.add(mqjcode);
|
|
|
|
- params.add(jbfcode);
|
|
|
|
- params.add(khjcode);
|
|
|
|
- params.add(aqwmxfjcode);
|
|
|
|
- params.add(ftcode);
|
|
|
|
- params.add(kkcode);
|
|
|
|
- params.add(ydgzcode);
|
|
|
|
- params.add(sycode);
|
|
|
|
- params.add(ylcode);
|
|
|
|
- params.add(ybcode);
|
|
|
|
- params.add(gjjcode);
|
|
|
|
- params.add(njcode);
|
|
|
|
- params.add(bqsecode);
|
|
|
|
- params.add(hfcode);
|
|
|
|
- params.add(hzjcode);
|
|
|
|
- params.add(qtkkcode);
|
|
|
|
- params.add(sdgzcode);
|
|
|
|
- request.setParams(params);
|
|
|
|
-
|
|
|
|
- //用于Mac,MD5加密
|
|
|
|
- List<String> macparamslis = new ArrayList<String>();
|
|
|
|
- macparamslis.add("\"" + psndocMap.get(datasvo.getPk_psndoc()).getName() + "\"");
|
|
|
|
- macparamslis.add("\"" + convertToChineseDate(ym) + "\"");
|
|
|
|
- macparamslis.add("\"" +gwgzcode+ "\""); //岗位工资
|
|
|
|
- macparamslis.add("\"" +jxjcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +zhbtcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +nggzcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +zcbwcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +zybfcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +mqjcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +jbfcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +khjcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +aqwmxfjcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +ftcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +kkcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +ydgzcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +sycode+ "\"");
|
|
|
|
- macparamslis.add("\"" +ylcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +ybcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +gjjcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +njcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +bqsecode+ "\"");
|
|
|
|
- macparamslis.add("\"" +hfcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +hzjcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +qtkkcode+ "\"");
|
|
|
|
- macparamslis.add("\"" +sdgzcode+ "\"");
|
|
|
|
-
|
|
|
|
- // 自定义输出,去掉逗号后的空格
|
|
|
|
- StringBuilder sb = new StringBuilder();
|
|
|
|
- sb.append("[");
|
|
|
|
- for (int i = 0; i < macparamslis.size(); i++) {
|
|
|
|
- if (i > 0) {
|
|
|
|
- sb.append(","); // 只加逗号,不加空格
|
|
|
|
- }
|
|
|
|
- sb.append(macparamslis.get(i));
|
|
|
|
- }
|
|
|
|
- sb.append("]");
|
|
|
|
- request.setMacparams(sb.toString());//["参数一","参数二"] 格式
|
|
|
|
- request.setSign("gF211Wxv6");//网关签名编码
|
|
|
|
- request.setAddSerial("");//扩展码
|
|
|
|
-
|
|
|
|
- StringBuffer stringBuffer=new StringBuffer();
|
|
|
|
- stringBuffer.append(request.getEcName());
|
|
|
|
- stringBuffer.append(request.getApId());
|
|
|
|
- stringBuffer.append(request.getSecretKey());
|
|
|
|
- stringBuffer.append(request.getTemplateId());
|
|
|
|
- stringBuffer.append(request.getMobiles());
|
|
|
|
- stringBuffer.append(request.getMacparams());
|
|
|
|
- stringBuffer.append(request.getSign());
|
|
|
|
-
|
|
|
|
- // 使用MD5哈希值作为mac字段
|
|
|
|
- request.setMac(MD5Util.md5(stringBuffer.toString()));//API输入参数签名结果,签名算法:将ecName,apId,secretKey,templateId,mobiles,params,sign,addSerial按照顺序拼接,然后通过md5(32位小写)计算后得出的值
|
|
|
|
-
|
|
|
|
- // 发送短信
|
|
|
|
- SmsResponse response = sendSms(request);
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- if (response.isSuccess()) {
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- // 处理特定错误码
|
|
|
|
- if ("NOT_WHITE_IP".equals(response.getRspcod())) {
|
|
|
|
- ExceptionUtils.wrapException(new Exception("错误原因: IP地址未在白名单中,请联系管理员添加IP白名单!"));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- throw new BusinessException("短信发送失败,错误码: " + response.getRspcod());
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- MessageDialog.showHintDlg(getEntranceUI(), "提示", "薪资发送成功!");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取薪资发放项目对应的列
|
|
|
|
- * @param pkOrg 组织
|
|
|
|
- * @param pkWaclass 薪资方案
|
|
|
|
- * @param waPeriod 年月期间
|
|
|
|
- * @return
|
|
|
|
- * @throws Exception
|
|
|
|
- */
|
|
|
|
- private Map<String,String> getClassItem(String pkOrg, String pkWaclass, String waPeriod) throws Exception{
|
|
|
|
- //取年份
|
|
|
|
- String cyear = waPeriod.substring(0, 4);
|
|
|
|
- //取月份
|
|
|
|
- String cperiod = waPeriod.substring(4, 6);
|
|
|
|
- StringBuffer sql = new StringBuffer();
|
|
|
|
- sql.append(" SELECT");
|
|
|
|
- sql.append(" name,");
|
|
|
|
- sql.append(" itemkey");
|
|
|
|
- sql.append(" FROM ");
|
|
|
|
- sql.append(" wa_classitem");
|
|
|
|
- sql.append(" WHERE");
|
|
|
|
- sql.append(" pk_org = '"+pkOrg+"'");
|
|
|
|
- sql.append(" AND pk_wa_class = '"+pkWaclass+"'");
|
|
|
|
- sql.append(" AND cyear = '"+cyear+"' AND cperiod = '"+cperiod+"'");
|
|
|
|
- List<Object[]> list = (List<Object[]>) getIuapBs().executeQuery(sql.toString(), new ArrayListProcessor());
|
|
|
|
- Map<String,String> map = new HashMap<String,String>();
|
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
|
- map.put(list.get(i)[0].toString(), list.get(i)[1].toString());
|
|
|
|
- }
|
|
|
|
- return map;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- private String[] getPsndocPks(List<DataVO> datavos){
|
|
|
|
-
|
|
|
|
- String [] pk_psndocs=new String [datavos.size()];
|
|
|
|
-
|
|
|
|
- for(int i=0 ; i<datavos.size() ; i++){
|
|
|
|
-
|
|
|
|
- DataVO datavo=datavos.get(i);
|
|
|
|
-
|
|
|
|
- String pk_psndoc=datavo.getPk_psndoc();//人员主键
|
|
|
|
-
|
|
|
|
- pk_psndocs[i]=pk_psndoc;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return pk_psndocs;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- public static String convertToChineseDate(String dateStr) {
|
|
|
|
- try {
|
|
|
|
- SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
|
- SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy年MM月");
|
|
|
|
- Date date = inputFormat.parse(dateStr);
|
|
|
|
- return outputFormat.format(date);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- return dateStr; // 如果转换失败,返回原字符串
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * key 人员主键
|
|
|
|
- * value 人员VO
|
|
|
|
- * @param datasvos
|
|
|
|
- * @return
|
|
|
|
- * @throws BusinessException
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- private Map<String,PsndocVO> getPsndocvoMap(List<DataVO> datasvos) throws BusinessException{
|
|
|
|
-
|
|
|
|
- Map<String, PsndocVO> mapMater = new HashMap<String, PsndocVO>();
|
|
|
|
-
|
|
|
|
- PsndocVO[] psndocVOs=getIpsndocQueryService().queryPsndocByPks(getPsndocPks(datasvos));//人员档案查询
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < psndocVOs.length; i++) {
|
|
|
|
-
|
|
|
|
- mapMater.put(psndocVOs[i].getPrimaryKey(), psndocVOs[i]);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return mapMater;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 发送短信
|
|
|
|
- * @param request 短信请求对象
|
|
|
|
- * @return 发送结果
|
|
|
|
- */
|
|
|
|
- public SmsResponse sendSms(SmsRequest request) {
|
|
|
|
- HttpURLConnection connection = null;
|
|
|
|
- try {
|
|
|
|
- // 1. 创建URL对象
|
|
|
|
- URL url = new URL(API_URL);
|
|
|
|
-
|
|
|
|
- // 2. 创建连接
|
|
|
|
- connection = (HttpURLConnection) url.openConnection();
|
|
|
|
- connection.setRequestMethod("POST");
|
|
|
|
- connection.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
|
|
|
|
- connection.setRequestProperty("Accept", "application/json");
|
|
|
|
- connection.setDoOutput(true);
|
|
|
|
- connection.setConnectTimeout(5000);
|
|
|
|
- connection.setReadTimeout(10000);
|
|
|
|
-
|
|
|
|
- // 3. 将请求对象转换为JSON字符串
|
|
|
|
- String jsonInputString = request.toJsonString();
|
|
|
|
-
|
|
|
|
- // 4. Base64编码
|
|
|
|
- String base64Encoded = Base64Util.encode(jsonInputString);
|
|
|
|
-
|
|
|
|
- // 5. 发送请求数据
|
|
|
|
- OutputStream os = connection.getOutputStream();
|
|
|
|
- try {
|
|
|
|
- byte[] input = base64Encoded.getBytes("UTF-8");
|
|
|
|
- os.write(input, 0, input.length);
|
|
|
|
- } finally {
|
|
|
|
- if (os != null) {
|
|
|
|
- os.close();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 6. 获取响应
|
|
|
|
- int responseCode = connection.getResponseCode();
|
|
|
|
-
|
|
|
|
- if (responseCode == HttpURLConnection.HTTP_OK) {
|
|
|
|
- // 读取响应内容
|
|
|
|
- BufferedReader br = new BufferedReader(
|
|
|
|
- new InputStreamReader(connection.getInputStream(), "UTF-8"));
|
|
|
|
- try {
|
|
|
|
- StringBuilder response = new StringBuilder();
|
|
|
|
- String responseLine;
|
|
|
|
- while ((responseLine = br.readLine()) != null) {
|
|
|
|
- response.append(responseLine.trim());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 解析响应JSON
|
|
|
|
- return SmsResponse.fromJson(response.toString());
|
|
|
|
- } finally {
|
|
|
|
- if (br != null) {
|
|
|
|
- br.close();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- // 处理错误响应
|
|
|
|
- SmsResponse errorResponse = new SmsResponse();
|
|
|
|
- errorResponse.setSuccess(false);
|
|
|
|
- errorResponse.setRspcod(String.valueOf(responseCode));
|
|
|
|
- errorResponse.setMsgGroup("");
|
|
|
|
- return errorResponse;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- SmsResponse errorResponse = new SmsResponse();
|
|
|
|
- errorResponse.setSuccess(false);
|
|
|
|
- errorResponse.setRspcod("EXCEPTION");
|
|
|
|
- errorResponse.setMsgGroup("");
|
|
|
|
- return errorResponse;
|
|
|
|
- } finally {
|
|
|
|
- if (connection != null) {
|
|
|
|
- connection.disconnect();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 数据库查询
|
|
|
|
- */
|
|
|
|
- private String getSysinntValue() throws Exception {
|
|
|
|
-
|
|
|
|
- String sql = "select value from pub_sysinit where initcode ='DX001' and dr=0 " ;
|
|
|
|
-
|
|
|
|
- Object value = getIuapBs().executeQuery(sql, new ColumnProcessor());
|
|
|
|
-
|
|
|
|
- return value==null?"":value.toString();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|