package com.engine.htsc.payment.service.impl;

import com.engine.core.impl.Service;
import com.engine.htsc.payment.service.PaymentCubeService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;

import java.util.HashMap;
import java.util.Map;

public class PaymentCubeServiceImpl extends Service implements PaymentCubeService {
    private BaseBean log = new BaseBean();


    @Override
    public Map<String, Object> updateReadStatus(String requestid) {

        Map<String,Object> datas = new HashMap<>();
        try {
            RecordSet rs = new RecordSet();
            String lcydzt = "";
            rs.executeQuery("select lcydzt from uf_zbfk where requtid = ?",requestid);
            if (rs.next()){
                lcydzt = Util.null2String(rs.getString("lcydzt"));
            }
            if ("1".equals(lcydzt)){
                rs.executeUpdate("update uf_zbfk set lcydzt = 0 where requtid = ?",requestid);
            }
            datas.put("message","流程编号为"+requestid+"已更新阅读状态");
        }catch (Exception e){
            e.printStackTrace();
        }
        return datas;
    }


    @Override
    public Map<String, Object> updatePrintStatus(String ids) {

        Map<String,Object> datas = new HashMap<>();
        try {
            RecordSet rs = new RecordSet();
            String updateSql = " update uf_zbfk set dyzt=0 where id in ("+ids+") ";
            rs.executeUpdate(updateSql);

        }catch (Exception e){
            e.printStackTrace();
        }
        return datas;
    }
}
