UserServicefeeServiceImpl.java
2.71 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
/*
* Copyright (c) 2018, 2028, glsx and/or its affiliates. All rights reserved.
* GLSX PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package com.glsx.usercenter.service.impl;
import java.math.BigDecimal;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.glsx.usercenter.mapper.SysUserMapper;
import com.glsx.usercenter.mapper.SysUserServiceFeeMapper;
import com.glsx.usercenter.pojo.user.SysUserServiceFee;
import com.glsx.usercenter.service.IUserServicefeeService;
/**
* @ClassName: UserServicefeeServiceImpl
* @Description: TODO(这里用一句话描述这个类的作用)
* @author Zheng Xiajun
* @date 2019年12月25日
*
*/
@Service
public class UserServicefeeServiceImpl implements IUserServicefeeService {
public Logger logger = LoggerFactory.getLogger(UserServicefeeServiceImpl.class);
@Autowired
private SysUserServiceFeeMapper sysUserServiceFeeMapper;
/*
* (non-Javadoc)
*
* @see
* com.glsx.usercenter.service.IUserServicefeeService#getByUserID(java.lang.
* Integer)
*/
@Override
public List<SysUserServiceFee> getByUserID(Integer userId) {
// Auto-generated method stub
return sysUserServiceFeeMapper.selectByUserId(userId);
}
/*
* (non-Javadoc)
*
* @see
* com.glsx.usercenter.service.IUserServicefeeService#insertSelective(com.
* glsx.usercenter.pojo.user.SysUserServiceFee)
*/
@Override
public void insertSelective(SysUserServiceFee sysUserServiceFee) {
sysUserServiceFeeMapper.insertSelective(sysUserServiceFee);
}
/*
* (non-Javadoc)
*
* @see com.glsx.usercenter.service.IUserServicefeeService#insert(java.lang.
* String)
*/
@Override
public void insert(String str, int userId) {
// String str= 908,100,100,100|45874,200,200,200
if (StringUtils.isNotBlank(str)) {
sysUserServiceFeeMapper.deleteByUserId(userId);
String[] array = str.split("|");
for (int i = 0; i < array.length; i++) {
String item = array[i];
SysUserServiceFee sysUserServiceFee = new SysUserServiceFee();
sysUserServiceFee.setUserId(userId);
sysUserServiceFee.setServiceCode(item.split(",")[0]);
sysUserServiceFee.setInstallationFee(new BigDecimal(item.split(",")[1]));
sysUserServiceFee.setRepairFee(new BigDecimal(item.split(",")[2]));
sysUserServiceFee.setDismantleFee(new BigDecimal(item.split(",")[3]));
sysUserServiceFeeMapper.insertSelective(sysUserServiceFee);
}
}
}
}