{
    分享网正式开通,我们为大家提供免费资源,欢迎大家踊跃投稿!

JAVA客户关系管理系统CRM源码_源码下载

【实例简介】

【实例截图】

【核心代码】

 

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

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

package com.web.action;

 

import java.util.List;

 

import javax.annotation.Resource;

 

import org.apache.commons.lang3.StringUtils;

import org.apache.struts2.ServletActionContext;

import org.apache.struts2.convention.annotation.Action;

import org.apache.struts2.convention.annotation.Namespace;

import org.apache.struts2.convention.annotation.ParentPackage;

import org.apache.struts2.convention.annotation.Result;

import org.apache.struts2.convention.annotation.Results;

import org.hibernate.criterion.DetachedCriteria;

import org.hibernate.criterion.Restrictions;

import org.springframework.context.annotation.Scope;

import org.springframework.stereotype.Controller;

 

import com.bean.BaseDict;

import com.bean.Customer;

import com.opensymphony.xwork2.ActionContext;

import com.opensymphony.xwork2.ActionSupport;

import com.opensymphony.xwork2.ModelDriven;

import com.opensymphony.xwork2.util.ValueStack;

import com.service.CustomerService;

import com.web.commons.Page;

 

@Controller("customerAction")

@Scope("prototype")

@ParentPackage("struts-default")

@Namespace("/customer")

@Results({ @Result(name = "addUI", type = "dispatcher", location = "/jsp/customer/add.jsp"),

        @Result(name = "listCustomer", type = "dispatcher", location = "/jsp/customer/list.jsp"),

        @Result(name = "allCustomer", type = "redirectAction", location = "findAllCustomer"),

        @Result(name = "editUI", type = "dispatcher", location = "/jsp/customer/edit.jsp"),

        @Result(name = "industryCount", type = "dispatcher", location = "/jsp/statistic/indlist.jsp"),

        @Result(name = "sourceCount", type = "dispatcher", location = "/jsp/statistic/soulist.jsp")

})

 

         

public class CustomerAction extends ActionSupport implements ModelDriven<Customer> {

    private List list;

    private Integer curNum;

     

    private Page<Customer> page;

 

    private List<BaseDict> customerSources;

 

    private List<BaseDict> customerLevels;

 

    @Resource(name = "customerService")

    private CustomerService customerService;

 

    private Customer customer = new Customer();

 

    public void setCustomer(Customer customer) {

        this.customer = customer;

    }

 

    @Override

    public Customer getModel() {

 

        return customer;

    }

     

    

    @Action("customerIndustryCount")

    public String customerIndustryCount() {

        list=customerService.customerIndustryCount();

        return "industryCount";

    }

    

    @Action("customerSourceCount")

    public String customerSourceCount() {

        list=customerService.findCustomerSourceCount();

         

        return "sourceCount";

    }

    

    @Action("editCustomer")

    public String editCustomer() {

        customerService.updateCustomer(customer);

        return "allCustomer";

    }

 

    

    @Action("editUICustomer")

    public String editUICustomer() {

        // 查询获取客户来源

        customerSources = customerService.findAllCustomerSource();

 

        // 查询所有客户级别

        customerLevels = customerService.findAllCustomerLevel();

            //此处自己定义对象是为了避免和customer对象造成混淆,模型中的customer和查出获得到的两个customer不是同一个对象,所以如果直接压栈,将会是空

        Customer c=customerService.findByIdCustomer(customer.getCust_id());

        //把获取到的对象压入值栈

        ActionContext.getContext().getValueStack().push(c);

        return "editUI";

    }

 

    

    @Action("removeCustomer")

    public String removeCustomer() {

        customerService.removeByIdCustomer(customer.getCust_id());

        return "allCustomer";

    }

 

    

    @Action("addUICustomer")

    public String addUICustomer() {

        // 查询获取客户来源

        customerSources = customerService.findAllCustomerSource();

 

        // 查询所有客户级别

        customerLevels = customerService.findAllCustomerLevel();

        return "addUI";

    }

 

    

    @Action("findAllCustomer")

    public String findAllCustomer() {

        //1.创建离线查询东西

        DetachedCriteria dCriteria = DetachedCriteria.forClass(Customer.class);

        //2.拼装查询条件

        //判断是否提供了客户名称,此处将使用apach提供的判断字符串的工具类commm-lang3.jar isNotBlank()可以去掉空格后判断字符串部位null或者""

        if (StringUtils.isNotBlank(customer.getCust_name())) {

            //添加条件,模糊查询客户名称

            dCriteria.add(Restrictions.like("cust_name","%" customer.getCust_name() "%"));

        }

        //判断是否提供了客户行业

        if (StringUtils.isNotBlank(customer.getCust_industry())) {

            //添加条件,模糊查询客户行业

            dCriteria.add(Restrictions.like("cust_industry","%" customer.getCust_industry() "%"));

        }

        //判断是否提供了客户来源

        if (customer.getCust_source()!=null && StringUtils.isNotBlank(customer.getCust_source().getDict_id())) {

            //精确查询客户来源

            dCriteria.add(Restrictions.eq("cust_source",customer.getCust_source()));

        }

        //判断是否提供了客户级别

        if (customer.getCust_level()!=null && StringUtils.isNotBlank(customer.getCust_level().getDict_id())) {

            //精确查询客户级别

            dCriteria.add(Restrictions.eq("cust_level",customer.getCust_level()));

        }

        //3.按条件查询客户信息

        page = customerService.findAllCustomer(dCriteria, curNum);

        //4.查询获取客户来源

        customerSources = customerService.findAllCustomerSource();

         

        //5.查询所有客户级别

        customerLevels = customerService.findAllCustomerLevel();

        return "listCustomer";

    }

 

    

    @Action("addCustomer")

    public String addCustomer() {

        customerService.saveCustomer(customer);

        return "allCustomer";

    }

 

    // 把查询到的信息放在值栈中

      

 

    public List<BaseDict> getCustomerSources() {

        return customerSources;

    }

 

    public Page<Customer> getPage() {

        return page;

    }

 

    public void setPage(Page<Customer> page) {

        this.page = page;

    }

 

    public void setCustomerSources(List<BaseDict> customerSources) {

        this.customerSources = customerSources;

    }

 

    public List<BaseDict> getCustomerLevels() {

        return customerLevels;

    }

 

    public void setCustomerLevels(List<BaseDict> customerLevels) {

        this.customerLevels = customerLevels;

    }

 

    public Integer getCurNum() {

        return curNum;

    }

 

    public void setCurNum(Integer curNum) {

        this.curNum = curNum;

    }

 

    public List getList() {

        return list;

    }

 

    public void setList(List list) {

        this.list = list;

    }

 

      

 

}


资源均来自第三方,谨慎下载,前往第三方网站下载


米微资源分享网 , 版权所有丨本站资源仅限于学习研究,严禁从事商业或者非法活动!丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:JAVA客户关系管理系统CRM源码_源码下载
喜欢 ()分享 (0)