SettingService.java
2.77 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package cn.csbr.app.service;
import cn.csbr.app.config.FxConfigure;
import cn.csbr.app.gui.GUIContext;
import cn.csbr.springboot.dao.mapper.CabinetMapper;
import cn.csbr.springboot.dao.mapper.SysUserMapper;
import cn.csbr.springboot.dao.model.Cabinet;
import cn.csbr.springboot.dao.model.SysUser;
import com.alibaba.fastjson.JSON;
import com.csbr.mybatis.CommonMapper;
import tk.mybatis.mapper.entity.Example;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 系统设置业务类
*/
@Service
public class SettingService {
@Autowired
private GUIContext guiContext;
@Autowired
private CabinetMapper cabinetMapper;
@Autowired
private SysUserMapper sysUserMapper;
@Autowired
private FxConfigure fxConfigure;
@Autowired
private CommonMapper commonMapper;
public List<Cabinet> findCabinetByGroupCode(String groupCode) {
Example example = new Example(Cabinet.class);
example.createCriteria().andEqualTo("groupcode", groupCode).andEqualTo("storeguid",guiContext.getStoreguid());
List<Cabinet> cabinets = cabinetMapper.selectByExample(example);
return cabinets;
}
public Map<String, String> loadPropertyInfo() {
List<Cabinet> cabinetList = findCabinetByGroupCode(fxConfigure.getCabinetGroupCode());
Map<String, String> propertyMap = new HashMap<>();
propertyMap.put("耗材柜组编码", fxConfigure.getCabinetGroupCode());
propertyMap.put("配属机构", "尚未分配");
if (cabinetList != null && cabinetList.size() > 0) {
propertyMap.put("配属机构", cabinetList.get(0).getStorename());
}
return propertyMap;
}
public List<SysUser> loadSysUser() {
List<Cabinet> cabinetList = findCabinetByGroupCode(fxConfigure.getCabinetGroupCode());
if (cabinetList == null && cabinetList.size() == 0) {
return new ArrayList();
}
String sql = " select ta.* from sys_user ta where exists (select 'x' from sys_store_org tb where ta.orgguid=tb.deptguid and tb.storeguid="+"'"+guiContext.getStoreguid()+"'"+") ";
List<Map> maps = commonMapper.queryList(sql);
//logger.info("sql"+sql);
List<SysUser> sysUserList = new ArrayList<SysUser>();
for (Map map : maps) {
SysUser sysUser = JSON.parseObject(JSON.toJSONString(map), SysUser.class);
sysUserList.add(sysUser);
}
return sysUserList;
}
public void saveFingerPrint(SysUser user) {
user.setFingerprint(loadFinger());
sysUserMapper.updateByPrimaryKey(user);
}
private String loadFinger() {
return "";
}
}