cy
2022-06-22 425675051e544cf29b2132615cfbf7a93dc5e51f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package cn.ksource.web.service.flow;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Service;
 
import cn.ksource.beans.FlowRecord;
import cn.ksource.core.dao.BaseDao;
import cn.ksource.core.util.DateUtil;
import cn.ksource.core.util.StringUtil;
import cn.ksource.web.service.flow.FlowRecordService;
 
@Service
@SuppressWarnings({"unchecked","rawtypes"})
public class FlowRecordServiceImpl implements FlowRecordService{
    
    @Resource
    private BaseDao baseDao;
    
    @Override
    public boolean addRecord(FlowRecord flowRecord) {
        flowRecord.setId(StringUtil.getUUID());
        StringBuilder sql = new StringBuilder();
        sql.append(" insert into flow_record ");
        sql.append(" (id,bus_id,template_key,flag,deal_id,deal_name,deal_time,note,extend_text,state,result_key,result_val) ");
        sql.append(" values ");
        sql.append(" (:id,:busId,:templateKey,:flag,:dealId,:dealName,:dealTime,:note,:extendText,1,:resultKey,:resultVal) ");
        Map map = new HashMap();
        map.put("id", flowRecord.getId());
        map.put("busId", flowRecord.getBusId());
        map.put("templateKey", flowRecord.getTemplateKey());
        map.put("flag", flowRecord.getResult());
        map.put("dealId", flowRecord.getDealId());
        map.put("dealName", flowRecord.getDealName());
        map.put("dealTime", DateUtil.getCurrentDate14());
        map.put("note", flowRecord.getNote());
        map.put("extendText", flowRecord.getExtendText());
        map.put("resultKey", flowRecord.getResKey());
        map.put("resultVal", flowRecord.getResVal());
        Integer num = baseDao.execute(sql.toString(), map);
        if(num!=null&&num>0){
            return true;
        }
        return false;
    }
 
    @Override
    public List<Map> getRecordListByBusId(String busId, String extend){
        StringBuilder sql = new StringBuilder();
        Map map = new HashMap();
        sql.append(" select * from flow_record where bus_id =:busId and state=1  ");
        if(StringUtil.isNotBlank(extend)){
            sql.append(" and extend_text=:extend");
        }
        sql.append(" order by deal_time desc  ");
        map.put("busId", busId);
        map.put("extend", extend);
        return baseDao.queryForList(sql.toString(), map);
    }
    
}