新增品
This commit is contained in:
@@ -6,203 +6,202 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
* @author Administrator
|
||||
*/
|
||||
@Data
|
||||
public class SysUser {
|
||||
private Integer userId;
|
||||
private Integer userId;
|
||||
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
public Integer getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public void setUserId(Integer userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getRealname() {
|
||||
return realname;
|
||||
}
|
||||
public String getRealname() {
|
||||
return realname;
|
||||
}
|
||||
|
||||
public void setRealname(String realname) {
|
||||
this.realname = realname;
|
||||
}
|
||||
public void setRealname(String realname) {
|
||||
this.realname = realname;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
public String getUserStatus() {
|
||||
return userStatus;
|
||||
}
|
||||
|
||||
public void setUserStatus(String userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
public void setUserStatus(String userStatus) {
|
||||
this.userStatus = userStatus;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getSysStatus() {
|
||||
return sysStatus;
|
||||
}
|
||||
public String getSysStatus() {
|
||||
return sysStatus;
|
||||
}
|
||||
|
||||
public void setSysStatus(String sysStatus) {
|
||||
this.sysStatus = sysStatus;
|
||||
}
|
||||
public void setSysStatus(String sysStatus) {
|
||||
this.sysStatus = sysStatus;
|
||||
}
|
||||
|
||||
public String getReadLogStatus() {
|
||||
return readLogStatus;
|
||||
}
|
||||
public String getReadLogStatus() {
|
||||
return readLogStatus;
|
||||
}
|
||||
|
||||
public void setReadLogStatus(String readLogStatus) {
|
||||
this.readLogStatus = readLogStatus;
|
||||
}
|
||||
public void setReadLogStatus(String readLogStatus) {
|
||||
this.readLogStatus = readLogStatus;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
public Date getCreateDate() {
|
||||
return createDate;
|
||||
}
|
||||
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
public void setCreateDate(Date createDate) {
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
public Date getUpdateDate() {
|
||||
return updateDate;
|
||||
}
|
||||
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
public void setUpdateDate(Date updateDate) {
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
public String getBirthDay() {
|
||||
return birthDay;
|
||||
}
|
||||
public String getBirthDay() {
|
||||
return birthDay;
|
||||
}
|
||||
|
||||
public void setBirthDay(String birthDay) {
|
||||
this.birthDay = birthDay;
|
||||
}
|
||||
public void setBirthDay(String birthDay) {
|
||||
this.birthDay = birthDay;
|
||||
}
|
||||
|
||||
public String getBirthType() {
|
||||
return birthType;
|
||||
}
|
||||
public String getBirthType() {
|
||||
return birthType;
|
||||
}
|
||||
|
||||
public void setBirthType(String birthType) {
|
||||
this.birthType = birthType;
|
||||
}
|
||||
public void setBirthType(String birthType) {
|
||||
this.birthType = birthType;
|
||||
}
|
||||
|
||||
public Integer getIsBirthDay() {
|
||||
return isBirthDay;
|
||||
}
|
||||
public Integer getIsBirthDay() {
|
||||
return isBirthDay;
|
||||
}
|
||||
|
||||
public void setIsBirthDay(Integer isBirthDay) {
|
||||
this.isBirthDay = isBirthDay;
|
||||
}
|
||||
public void setIsBirthDay(Integer isBirthDay) {
|
||||
this.isBirthDay = isBirthDay;
|
||||
}
|
||||
|
||||
public String getEntryDate() {
|
||||
return entryDate;
|
||||
}
|
||||
public String getEntryDate() {
|
||||
return entryDate;
|
||||
}
|
||||
|
||||
public void setEntryDate(String entryDate) {
|
||||
this.entryDate = entryDate;
|
||||
}
|
||||
public void setEntryDate(String entryDate) {
|
||||
this.entryDate = entryDate;
|
||||
}
|
||||
|
||||
public String getNeedIp() {
|
||||
return needIp;
|
||||
}
|
||||
public String getNeedIp() {
|
||||
return needIp;
|
||||
}
|
||||
|
||||
public void setNeedIp(String needIp) {
|
||||
this.needIp = needIp;
|
||||
}
|
||||
public void setNeedIp(String needIp) {
|
||||
this.needIp = needIp;
|
||||
}
|
||||
|
||||
public String getRoleSearch() {
|
||||
return roleSearch;
|
||||
}
|
||||
public String getRoleSearch() {
|
||||
return roleSearch;
|
||||
}
|
||||
|
||||
public void setRoleSearch(String roleSearch) {
|
||||
this.roleSearch = roleSearch;
|
||||
}
|
||||
public void setRoleSearch(String roleSearch) {
|
||||
this.roleSearch = roleSearch;
|
||||
}
|
||||
|
||||
public String[] getRoleArr() {
|
||||
return roleArr;
|
||||
}
|
||||
public String[] getRoleArr() {
|
||||
return roleArr;
|
||||
}
|
||||
|
||||
public void setRoleArr(String[] roleArr) {
|
||||
this.roleArr = roleArr;
|
||||
}
|
||||
public void setRoleArr(String[] roleArr) {
|
||||
this.roleArr = roleArr;
|
||||
}
|
||||
|
||||
private String realname;
|
||||
private String realname;
|
||||
|
||||
private String username;
|
||||
private String username;
|
||||
|
||||
private String password;
|
||||
private String password;
|
||||
|
||||
private String userStatus;
|
||||
private String userStatus;
|
||||
|
||||
private String role;
|
||||
private String role;
|
||||
|
||||
private String sysStatus;
|
||||
private String sysStatus;
|
||||
|
||||
private String readLogStatus;
|
||||
private String readLogStatus;
|
||||
|
||||
private String createBy;
|
||||
private String createBy;
|
||||
|
||||
private Date createDate;
|
||||
private Date createDate;
|
||||
|
||||
private String updateBy;
|
||||
private String updateBy;
|
||||
|
||||
private Date updateDate;
|
||||
private Date updateDate;
|
||||
|
||||
private String birthDay;
|
||||
private String birthDay;
|
||||
|
||||
private String birthType;
|
||||
private String birthType;
|
||||
|
||||
private Integer isBirthDay;
|
||||
private Integer isBirthDay;
|
||||
|
||||
private String entryDate;
|
||||
private String entryDate;
|
||||
|
||||
// 是否需要判断IP 0:否 1:是
|
||||
private String needIp;
|
||||
// 是否需要判断IP 0:否 1:是
|
||||
private String needIp;
|
||||
|
||||
// 根据角色查找用户
|
||||
private String roleSearch;
|
||||
// 根据角色查找用户
|
||||
private String roleSearch;
|
||||
|
||||
// 用户所拥有角色数组
|
||||
private String[] roleArr;
|
||||
// 用户所拥有角色数组
|
||||
private String[] roleArr;
|
||||
|
||||
}
|
||||
@@ -4658,31 +4658,103 @@ public class ProductService {
|
||||
double[] areas = {1, 4, 6, 9, 12, 16, 20, 25, 36, 45, 48.6, 54, 60, 72, 81};
|
||||
|
||||
area = length * width;
|
||||
for (int i = 0; i < count_list.length; i++) {
|
||||
int count_item = count_list[i];
|
||||
if (priceList.size() > 2) {
|
||||
break;
|
||||
}
|
||||
if (count > count_item) {
|
||||
continue;
|
||||
}
|
||||
int count_index = Arrays.binarySearch(count_list, count_item);
|
||||
price = 0;
|
||||
if (count_index >= 0) {
|
||||
price = new PriceUtils().TablePrice(area, prices[count_index], areas);
|
||||
}
|
||||
Product product = new Product();
|
||||
product.setCount(count_item);
|
||||
product.setPrice(Math.ceil(price * number));
|
||||
priceList.add(product);
|
||||
return getAreaCenterPrice(count_list, count, area, prices, areas, number);
|
||||
case "透卡":
|
||||
prices = new int[][]{
|
||||
{136, 163, 177, 190, 197, 227, 257, 303, 333, 407, 430},
|
||||
{193, 250, 277, 300, 313, 373, 433, 530, 587, 733, 780},
|
||||
{250, 337, 373, 410, 430, 520, 613, 757, 840, 1063, 1133},
|
||||
{307, 423, 473, 523, 547, 670, 790, 983, 1097, 1390, 1483},
|
||||
{333, 463, 520, 573, 603, 737, 873, 1090, 1210, 1540, 1643},
|
||||
{490, 697, 783, 873, 917, 1133, 1350, 1693, 1890, 2417, 2580},
|
||||
{533, 760, 857, 953, 1003, 1237, 1477, 1853, 2067, 2643, 2823},
|
||||
{990, 1440, 1633, 1830, 1927, 2397, 2873, 3627, 4057, 5207, 5567},
|
||||
{2007, 2943, 3347, 3747, 3950, 4927, 5910, 7473, 8367, 10743, 11490},
|
||||
{3013, 4413, 5013, 5613, 5913, 7373, 8847, 11180, 12513, 14077, 16007},
|
||||
};
|
||||
count_list = new int[]{100, 200, 300, 400, 500, 800, 1000, 2000, 5000, 10000};
|
||||
areas = new double[]{22.5, 35.1, 40.5, 45.9, 48.6, 67.75, 75, 96, 108, 140, 150};
|
||||
area = length * width;
|
||||
return getAreaCenterPrice(count_list, count, area, prices, areas, number);
|
||||
case "澜达海报":
|
||||
//铜版纸200g (售价)
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 94, 94, 94, 94},
|
||||
{100, 100, 100, 100, 100, 187, 187, 187, 187},
|
||||
{140, 140, 140, 140, 140, 280, 280, 280, 280},
|
||||
{187, 187, 187, 187, 187, 374, 374, 374, 374},
|
||||
{234, 234, 234, 234, 234, 467, 467, 467, 467},
|
||||
{467, 467, 467, 467, 467, 934, 934, 934, 934},
|
||||
{934, 934, 934, 934, 934, 1867, 1867, 1867, 1867},
|
||||
{2334, 2334, 2334, 2334, 2334, 4667, 4667, 4667, 4667},
|
||||
{4667, 4667, 4667, 4667, 4667, 9334, 9334, 9334, 9334},
|
||||
{9334, 9334, 9334, 9334, 9334, 18667, 18667, 18667, 18667},
|
||||
{23334, 23334, 23334, 23334, 23334, 46667, 46667, 46667, 46667},
|
||||
};
|
||||
if ("2".equals(dto.getKind())) {
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 107, 107, 107, 107},
|
||||
{100, 107, 107, 107, 107, 213, 213, 213, 213},
|
||||
{120, 160, 160, 160, 160, 320, 320, 320, 320},
|
||||
{150, 213, 213, 213, 213, 427, 427, 427, 427},
|
||||
{139, 267, 267, 267, 267, 533, 533, 533, 533},
|
||||
{267, 533, 533, 533, 533, 1067, 1067, 1067, 1067},
|
||||
{533, 1067, 1067, 1067, 1067, 2133, 2133, 2133, 2133},
|
||||
{1333, 2667, 2667, 2667, 2667, 5333, 5333, 5333, 5333},
|
||||
{2667, 5333, 5333, 5333, 5333, 10667, 10667, 10667, 10667},
|
||||
{5333, 10667, 10667, 10667, 10667, 21333, 21333, 21333, 21333},
|
||||
{13333, 26667, 26667, 26667, 26667, 53333, 53333, 53333, 53333},
|
||||
};
|
||||
}
|
||||
return priceList;
|
||||
if ("3".equals(dto.getKind())) {
|
||||
prices = new int[][]{
|
||||
{90, 90, 90, 90, 90, 150, 150, 150, 150},
|
||||
{100, 140, 140, 150, 150, 300, 300, 300, 300},
|
||||
{110, 207, 207, 223, 223, 447, 447, 447, 447},
|
||||
{140, 277, 277, 300, 300, 597, 597, 597, 597},
|
||||
{180, 347, 347, 373, 373, 747, 747, 747, 747},
|
||||
{347, 693, 693, 747, 747, 1493, 1493, 1493, 1493},
|
||||
{693, 1387, 1387, 1493, 1493, 2987, 2987, 2987, 2987},
|
||||
{1733, 3467, 3467, 3733, 3733, 7467, 7467, 7467, 7467},
|
||||
{3467, 6933, 6933, 7467, 7467, 14933, 14933, 14933, 14933},
|
||||
{6933, 13867, 13867, 14933, 14933, 29867, 29867, 29867, 29867},
|
||||
{17333, 34667, 34667, 37333, 37333, 74667, 74667, 74667, 74667},
|
||||
};
|
||||
}
|
||||
count_list = new int[]{10, 20, 30, 40, 50, 100, 200, 500, 1000, 2000, 5000};
|
||||
areas = new double[]{1197, 1716, 2394, 2596, 3430, 3467.1, 4788, 5192, 6860};
|
||||
area = length * width;
|
||||
|
||||
return getAreaCenterPrice(count_list, count, area, prices, areas, number);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private List<Product> getAreaCenterPrice(int[] count_list, int count, double area, int[][] prices, double[] areas, int number) {
|
||||
List<Product> priceList = new ArrayList<>();
|
||||
for (int i = 0; i < count_list.length; i++) {
|
||||
int count_item = count_list[i];
|
||||
if (priceList.size() > 2) {
|
||||
break;
|
||||
}
|
||||
if (count > count_item) {
|
||||
continue;
|
||||
}
|
||||
int count_index = Arrays.binarySearch(count_list, count_item);
|
||||
double price = 0;
|
||||
if (count_index >= 0) {
|
||||
price = new PriceUtils().TablePrice(area, prices[count_index], areas);
|
||||
}
|
||||
Product product = new Product();
|
||||
product.setCount(count_item);
|
||||
product.setPrice(Math.ceil(price * number));
|
||||
priceList.add(product);
|
||||
}
|
||||
return priceList;
|
||||
}
|
||||
|
||||
private List<Product> lessSticker(Product dto, String kind, Integer number, Double width, Double length,
|
||||
int count, List<Product> stickersList, String role) {
|
||||
double price = 0.0;
|
||||
|
||||
@@ -18,252 +18,253 @@ import lingtao.net.util.MD5Util;
|
||||
@Service
|
||||
public class SysUserService {
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
|
||||
// 注册
|
||||
public Msg register(SysUser user) {
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
user.setCreateDate(new Date());
|
||||
// 注册的用户都是未激活状态
|
||||
user.setUserStatus("0");
|
||||
// 注册的用户都是系统功能隐藏状态
|
||||
user.setSysStatus("0");
|
||||
// 注册的用户不需要判断IP
|
||||
user.setNeedIp("1");
|
||||
String roleId = user.getRole();
|
||||
if (StringUtils.isEmpty(roleId))
|
||||
return null;
|
||||
// 给用户赋予角色
|
||||
user.setRole("999," + roleId);
|
||||
// user.setRole("999");
|
||||
// Integer[] ids = {999};
|
||||
int count = userMapper.insertSelective(user);
|
||||
// 根据角色的id把角色的权限给用户
|
||||
Integer[] ids = { 999, Integer.valueOf(roleId) };
|
||||
// 新增用户后会自动回补id
|
||||
Integer userId = user.getUserId();
|
||||
userMapper.addUserRoles(userId, ids);
|
||||
if (count < 0) {
|
||||
return Msg.fail();
|
||||
}
|
||||
return Msg.success();
|
||||
}
|
||||
// 注册
|
||||
public Msg register(SysUser user) {
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
user.setCreateDate(new Date());
|
||||
// 注册的用户都是未激活状态
|
||||
user.setUserStatus("0");
|
||||
// 注册的用户都是系统功能隐藏状态
|
||||
user.setSysStatus("0");
|
||||
// 注册的用户不需要判断IP
|
||||
user.setNeedIp("1");
|
||||
String roleId = user.getRole();
|
||||
if (StringUtils.isEmpty(roleId))
|
||||
return null;
|
||||
// 给用户赋予角色
|
||||
user.setRole("999," + roleId);
|
||||
// user.setRole("999");
|
||||
// Integer[] ids = {999};
|
||||
int count = userMapper.insertSelective(user);
|
||||
// 根据角色的id把角色的权限给用户
|
||||
Integer[] ids = {999, Integer.valueOf(roleId)};
|
||||
// 新增用户后会自动回补id
|
||||
Integer userId = user.getUserId();
|
||||
userMapper.addUserRoles(userId, ids);
|
||||
if (count < 0) {
|
||||
return Msg.fail();
|
||||
}
|
||||
return Msg.success();
|
||||
}
|
||||
|
||||
public List<SysUser> getUsers(SysUser user) {
|
||||
// 用户所拥有的角色
|
||||
String[] roleArr = user.getRole().split(",");
|
||||
// 转成list,拿掉‘组长’身份
|
||||
List<String> list = new ArrayList<String>(Arrays.asList(roleArr));
|
||||
// 判断是否拥有超管身份标识
|
||||
boolean isSuper = false;
|
||||
for (int i = 0; i < roleArr.length; i++) {
|
||||
// 有‘超级管理员’身份,状态改为true
|
||||
if ("1".equals(roleArr[i])) {
|
||||
isSuper = true;
|
||||
break;
|
||||
}
|
||||
public List<SysUser> getUsers(SysUser user) {
|
||||
// 用户所拥有的角色
|
||||
String[] roleArr = user.getRole().split(",");
|
||||
// 转成list,拿掉‘组长’身份
|
||||
List<String> list = new ArrayList<String>(Arrays.asList(roleArr));
|
||||
// 判断是否拥有超管身份标识
|
||||
boolean isSuper = false;
|
||||
for (int i = 0; i < roleArr.length; i++) {
|
||||
// 有‘超级管理员’身份,状态改为true
|
||||
if ("1".equals(roleArr[i])) {
|
||||
isSuper = true;
|
||||
break;
|
||||
}
|
||||
|
||||
// 如果有【店长/考试审核员/客服/组长/IP管理员/操作日志/不填旺旺】身份,去掉。不带去查询
|
||||
if ("666".equals(roleArr[i]) || "888".equals(roleArr[i]) || "999".equals(roleArr[i])
|
||||
|| "1011".equals(roleArr[i]) || "1015".equals(roleArr[i]) || "1042".equals(roleArr[i])
|
||||
|| "1049".equals(roleArr[i])) {
|
||||
list.remove(roleArr[i]);
|
||||
}
|
||||
}
|
||||
// 将list转为String[] 数组
|
||||
roleArr = list.toArray(new String[list.size()]);
|
||||
// 如果有【店长/考试审核员/客服/组长/IP管理员/操作日志/不填旺旺】身份,去掉。不带去查询
|
||||
if ("666".equals(roleArr[i]) || "888".equals(roleArr[i]) || "999".equals(roleArr[i])
|
||||
|| "1011".equals(roleArr[i]) || "1015".equals(roleArr[i]) || "1042".equals(roleArr[i])
|
||||
|| "1049".equals(roleArr[i])) {
|
||||
list.remove(roleArr[i]);
|
||||
}
|
||||
}
|
||||
// 将list转为String[] 数组
|
||||
roleArr = list.toArray(new String[list.size()]);
|
||||
|
||||
// 如果没有‘超级管理员’身份,只能看到负责的部门的用户;如果有可以看到所有用户
|
||||
if (!isSuper) {
|
||||
// 如果是通过‘用户角色’查询
|
||||
if (StringUtils.isNotEmpty(user.getRoleSearch())) {
|
||||
// 清除自己拥有的角色,防止查询出所有的部门数据
|
||||
roleArr = null;
|
||||
}
|
||||
// 如果有多个
|
||||
if (user.getRole().contains(",")) {
|
||||
user.setRoleArr(roleArr);
|
||||
} else {// 只有一个角色
|
||||
user.setRoleSearch(user.getRole());
|
||||
}
|
||||
}
|
||||
// 如果没有‘超级管理员’身份,只能看到负责的部门的用户;如果有可以看到所有用户
|
||||
if (!isSuper) {
|
||||
// 如果是通过‘用户角色’查询
|
||||
if (StringUtils.isNotEmpty(user.getRoleSearch())) {
|
||||
// 清除自己拥有的角色,防止查询出所有的部门数据
|
||||
roleArr = null;
|
||||
}
|
||||
// 如果有多个
|
||||
if (user.getRole().contains(",")) {
|
||||
user.setRoleArr(roleArr);
|
||||
} else {// 只有一个角色
|
||||
user.setRoleSearch(user.getRole());
|
||||
}
|
||||
}
|
||||
|
||||
return userMapper.getUsers(user);
|
||||
}
|
||||
return userMapper.getUsers(user);
|
||||
}
|
||||
|
||||
// 检查用户名是否存在
|
||||
public Msg checkUsername(String username) {
|
||||
SysUser user = userMapper.getUserByUsername(username);
|
||||
if (user != null) {
|
||||
return Msg.fail();
|
||||
}
|
||||
return Msg.success();
|
||||
}
|
||||
// 检查用户名是否存在
|
||||
public Msg checkUsername(String username) {
|
||||
SysUser user = userMapper.getUserByUsername(username);
|
||||
if (user != null) {
|
||||
return Msg.fail();
|
||||
}
|
||||
return Msg.success();
|
||||
}
|
||||
|
||||
// 新增
|
||||
public Msg addUser(SysUser user) {
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
user.setCreateDate(new Date());
|
||||
try {
|
||||
userMapper.insertSelective(user);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 新增
|
||||
public Msg addUser(SysUser user) {
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
user.setCreateDate(new Date());
|
||||
user.setSysStatus("2");
|
||||
try {
|
||||
userMapper.insertSelective(user);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
// 修改
|
||||
public Msg updateUserById(SysUser user) {
|
||||
if (!"********".equals(user.getPassword())) { // 如果改过密码
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
} else {
|
||||
user.setPassword(null);
|
||||
}
|
||||
// 如果有【店长】身份,更改的角色前面添加【客服】
|
||||
SysUser user2 = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
boolean flag = false;
|
||||
String[] role = user2.getRole().split(",");
|
||||
for (int i = 0; i < role.length; i++) {
|
||||
if ("666".equals(role[i])) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
user.setRole("999," + user.getRole());
|
||||
}
|
||||
user.setUpdateDate(new Date());
|
||||
try {
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 修改
|
||||
public Msg updateUserById(SysUser user) {
|
||||
if (!"********".equals(user.getPassword())) { // 如果改过密码
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
} else {
|
||||
user.setPassword(null);
|
||||
}
|
||||
// 如果有【店长】身份,更改的角色前面添加【客服】
|
||||
SysUser user2 = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
boolean flag = false;
|
||||
String[] role = user2.getRole().split(",");
|
||||
for (int i = 0; i < role.length; i++) {
|
||||
if ("666".equals(role[i])) {
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
user.setRole("999," + user.getRole());
|
||||
}
|
||||
user.setUpdateDate(new Date());
|
||||
try {
|
||||
userMapper.updateByPrimaryKeySelective(user);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
// 删除用户
|
||||
public Msg deleteUserById(Integer userId) {
|
||||
try {
|
||||
userMapper.deleteByPrimaryKey(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail("主外键关联,删除失败!");
|
||||
}
|
||||
}
|
||||
// 删除用户
|
||||
public Msg deleteUserById(Integer userId) {
|
||||
try {
|
||||
userMapper.deleteByPrimaryKey(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail("主外键关联,删除失败!");
|
||||
}
|
||||
}
|
||||
|
||||
// 改变用户状态
|
||||
public Msg changeUserStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.changeUserStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 改变用户状态
|
||||
public Msg changeUserStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.changeUserStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
public void addUserRoles(Integer userId, Integer[] ids) {
|
||||
userMapper.addUserRoles(userId, ids);
|
||||
}
|
||||
public void addUserRoles(Integer userId, Integer[] ids) {
|
||||
userMapper.addUserRoles(userId, ids);
|
||||
}
|
||||
|
||||
public void deleteUserRoles(Integer userId) {
|
||||
userMapper.deleteUserRoles(userId);
|
||||
}
|
||||
public void deleteUserRoles(Integer userId) {
|
||||
userMapper.deleteUserRoles(userId);
|
||||
}
|
||||
|
||||
public Msg updatePassword(SysUser user) {
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
int i = userMapper.updateByPrimaryKeySelective(user);
|
||||
if (i > 0) {
|
||||
return Msg.success();
|
||||
}
|
||||
return Msg.fail();
|
||||
}
|
||||
public Msg updatePassword(SysUser user) {
|
||||
user.setPassword(new MD5Util().md5(user.getPassword(), "lingtao"));
|
||||
int i = userMapper.updateByPrimaryKeySelective(user);
|
||||
if (i > 0) {
|
||||
return Msg.success();
|
||||
}
|
||||
return Msg.fail();
|
||||
}
|
||||
|
||||
public Msg addBirthDay(SysUser user) {
|
||||
SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setIsBirthDay(0);
|
||||
int i = userMapper.updateByPrimaryKeySelective(user);
|
||||
if (i > 0) {
|
||||
return Msg.success();
|
||||
}
|
||||
return Msg.fail();
|
||||
}
|
||||
public Msg addBirthDay(SysUser user) {
|
||||
SysUser sysUser = (SysUser) SecurityUtils.getSubject().getPrincipal();
|
||||
user.setUserId(sysUser.getUserId());
|
||||
user.setIsBirthDay(0);
|
||||
int i = userMapper.updateByPrimaryKeySelective(user);
|
||||
if (i > 0) {
|
||||
return Msg.success();
|
||||
}
|
||||
return Msg.fail();
|
||||
}
|
||||
|
||||
// 改变用户生日状态
|
||||
public Msg changeIsBirthDay(Integer userId) {
|
||||
try {
|
||||
userMapper.changeIsBirthDay(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 改变用户生日状态
|
||||
public Msg changeIsBirthDay(Integer userId) {
|
||||
try {
|
||||
userMapper.changeIsBirthDay(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
public Msg changeNeedIp() {
|
||||
try {
|
||||
userMapper.changeNeedIp();
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
public Msg changeNeedIp() {
|
||||
try {
|
||||
userMapper.changeNeedIp();
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
// 改变用户系统状态(管理员调整)
|
||||
public Msg changeSysStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.changeSysStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 改变用户系统状态(管理员调整)
|
||||
public Msg changeSysStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.changeSysStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
// 改变用户系统状态(看完视频)
|
||||
public Msg videoOverToChangeSysStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.videoOverToChangeSysStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 改变用户系统状态(看完视频)
|
||||
public Msg videoOverToChangeSysStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.videoOverToChangeSysStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
// 改变用户系统状态(答题通过)
|
||||
public Msg examOverToChangeSysStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.examOverToChangeSysStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 改变用户系统状态(答题通过)
|
||||
public Msg examOverToChangeSysStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.examOverToChangeSysStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
// 改变阅读更新日志状态
|
||||
public Msg changeReadLogStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.changeReadLogStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
// 改变阅读更新日志状态
|
||||
public Msg changeReadLogStatus(Integer userId) {
|
||||
try {
|
||||
userMapper.changeReadLogStatus(userId);
|
||||
return Msg.success();
|
||||
} catch (Exception e) {
|
||||
return Msg.fail();
|
||||
}
|
||||
}
|
||||
|
||||
public SysUser getUserInfo(Integer userId) {
|
||||
try {
|
||||
return userMapper.getUserInfo(userId);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public SysUser getUserInfo(Integer userId) {
|
||||
try {
|
||||
return userMapper.getUserInfo(userId);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 客服数据 -- 根据搜索的店铺获取人员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<SysUser> getRealnamesByShopname(String shopname) {
|
||||
return userMapper.getRealnamesByShopname(shopname);
|
||||
}
|
||||
/**
|
||||
* 客服数据 -- 根据搜索的店铺获取人员
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<SysUser> getRealnamesByShopname(String shopname) {
|
||||
return userMapper.getRealnamesByShopname(shopname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user