您的位置:首页 > 运维架构 > 网站架构

蒙牛CRM系统_java ssm架构

2017-05-23 15:17 381 查看

一、文章说明

           蒙牛CRM系统是我前不久使用java语言,spring+spring mvc+mybatis框架,自主完成的java项目,这也是学习任务。我对需求书的理解:为了更方便客户买到心仪的牛奶产品。做这个系统之前,我没有深刻的去了解该系统的相关知识,为了节省时间尽快完成作业,这也是完成项目后觉得做得不够好的一个原因。           当然了,蒙牛CRM系统的需求书是参考网上的,除此之外的数据库设计、界面设计、代码编写等都是自己完成的。网上的需求书只给了前台部分,后台部分只是自己简单模拟的。有种很奇怪的感觉,做这个项目的时候,遇到不懂的问题时觉得很难解决,但是,完成这个项目之后,突然觉得之前遇到的问题和花很多时间做出来的功能都很简单,而且还觉得自己完成得不够好,甚至于有些功能比需求书要求的要简单化了。下面将介绍这个系统的一些主要部分,小子不才,希望看到此文的大侠们给予客观的点评。

二、主要界面展示与说明

(1)预报订单新建:前台客户端的新建预报订单页面,客户把相关信息填写好,提交之后等待后台管理员审核,审核通过即可下单。

(2)预报订单审核:后台管理员审核客户提交的预报订单。

(3)生成销售订单:审核通过的预报订单便可生成销售订单信息,销售订单信息客户可在客户端查看。

(4)生成交货单:通过销售订单信息生成交货单,交货单信息客户可在客户端查看。

(5)生成出库单:通过交货单信息生成出库单,出库单信息客户可在客户端查看。

(6)生成派车单:通过交货单信息生成派车单,派车单信息客户可在客户端查看。

(7)生成对账单:通过交货单信息生成对账单,对账单信息客户可在客户端查看。

(8)客户入库确认:客户收到产品后的信息确认。

三、项目代码分享

(1)生成、读取xls文档(生成是具体的例子,代码也有注释,只要把相应的代码修改一下就可以使用啦)

Controller层代码:

package com.fangjian.poi;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;

/**
* 写xls文件
* @author fangjian
* @created 2016-11-12
*/
public class WriteExcel {
//使用POI创建excel工作簿
public static void createWorkBook() throws IOException {
/**
* 生成xls文档
* 使用POI创建excel工作簿
*/
@RequestMapping("createWorkBook")
public String createWorkBook() throws IOException {
// 创建excel工作簿
Workbook wb = new HSSFWorkbook();
// 创建第一个sheet(页),命名为 new sheet
Sheet sheet1 = wb.createSheet("第一个sheet1");

// Row:行 ;Cell:方格 ;Row和 Cell都是从0开始计数的;创建一行,在页sheet上
Row row = sheet1.createRow((short) 0);
// 在row行上创建列;Cell cell = row.createCell(0); 设置列的值
row.createCell(0).setCellValue("销售订单编号");
row.createCell(1).setCellValue("预报订单编号");
row.createCell(2).setCellValue("客户全称");
row.createCell(3).setCellValue("单品名称");
row.createCell(4).setCellValue("项目属性");
row.createCell(5).setCellValue("管理机构");
row.createCell(6).setCellValue("项目类别");
row.createCell(7).setCellValue("调配确认人");
row.createCell(8).setCellValue("申请日期");
row.createCell(9).setCellValue("调配日期");
row.createCell(10).setCellValue("到货日期");
row.createCell(11).setCellValue("业态");
row.createCell(12).setCellValue("运输方式");
row.createCell(13).setCellValue("大区");
row.createCell(14).setCellValue("发货工厂");

List<Sellindent> sellindents = sellIndentService.SellIndentQuery();

for (int i = 1; i < sellindents.size() + 1; i++) {
// Row:行 ;Cell:方格 ;Row和 Cell都是从0开始计数的;创建一行,在页sheet上
Row row1 = sheet1.createRow((short) i);
// 在row行上创建列;Cell cell = row.createCell(0); 设置列的值
row1.createCell(0).setCellValue(sellindents.get(i - 1).getSellindentnumber());
row1.createCell(1).setCellValue(sellindents.get(i - 1).getPredictionindentnumber());
row1.createCell(2).setCellValue(sellindents.get(i - 1).getClientname());
row1.createCell(3).setCellValue(sellindents.get(i - 1).getProductname());
row1.createCell(4).setCellValue(sellindents.get(i - 1).getItemcategoryname());
row1.createCell(5).setCellValue(sellindents.get(i - 1).getCburbuname());
row1.createCell(6).setCellValue("待定");
row1.createCell(7).setCellValue("待定");
row1.createCell(8).setCellValue(sellindents.get(i - 1).getApplydate());
row1.createCell(9).setCellValue("待定");
row1.createCell(10).setCellValue(sellindents.get(i - 1).getArrivaldate());
row1.createCell(11).setCellValue(sellindents.get(i - 1).getFormatname());
row1.createCell(12).setCellValue(sellindents.get(i - 1).getTransportwayname());
row1.createCell(13).setCellValue(sellindents.get(i - 1).getRegionname());
row1.createCell(14).setCellValue(sellindents.get(i - 1).getDeliveryplacename());
}

// 创建一
9d35
个文件 命名为workbook.xls
FileOutputStream fileOut = new FileOutputStream("e:/workbook.xls");
// 把上面创建的工作簿输出到文件中
wb.write(fileOut);
// 关闭输出流
fileOut.close();

return SellIndentQuery_two();
}

//使用POI读入excel工作簿文件 (读取)
public static void readWorkBook() throws Exception {
// poi读取excel
//创建要读入的文件的输入流
InputStream inp = new FileInputStream("e:/workbook.xls");

//根据上述创建的输入流 创建工作簿对象
Workbook wb = WorkbookFactory.create(inp);
//得到第一页 sheet
//页Sheet是从0开始索引的
Sheet sheet = wb.getSheetAt(0);
//利用foreach循环 遍历sheet中的所有行
for (Row row : sheet) {
//遍历row中的所有方格
for (Cell cell : row) {
//输出方格中的内容,以空格间隔
System.out.print(cell.toString() + "  ");
}
//每一个行输出之后换行
System.out.println();
}
//关闭输入流
inp.close();
}

public static void main(String[] args) throws Exception {
// POITest.createWorkBook();
WriteExcel.createWorkBook();
}
}
用到的两个java包,链接如下:http://pan.baidu.com/s/1o82V1iU(2)表单验证jsp层代码:

引用到的js文件,链接如下:http://pan.baidu.com/s/1o89GYgU

(3)批量修改(具体例子)

Dao层:
/**
* 批量维护日期时间温度
*/
int InstorageAffirm_Update(Clientinstorageaffirm clientinstorageaffirm);

Mapper层:
<!--批量维护日期时间温度-->
<update id="InstorageAffirm_Update" parameterType="com.xiaochu.po.Clientinstorageaffirm">
update clientinstorageaffirm
set affirmdate = #{affirmdate}, affirmtime = #{affirmtime}, arrivaltemperature = #{arrivaltemperature}
where clientinstorageaffirmid = #{clientinstorageaffirmid}
</update>

Service层:
/**
* 批量维护日期时间温度
*/
int InstorageAffirm_Update(Clientinstorageaffirm clientinstorageaffirm);
/**
* 批量维护日期时间温度
*/
@Override
public int InstorageAffirm_Update(
Clientinstorageaffirm clientinstorageaffirm) {
return this.instorageAffirmDao.InstorageAffirm_Update(clientinstorageaffirm);
}

Controller层:
/**
* 批量维护日期时间温度
*/
@RequestMapping("instorageAffirm_Update")
public String InstorageAffirm_Update(){
//table中含有数据的总行数
String table_row = request.getParameter("table_row");
boolean b = false;
Clientinstorageaffirm clientinstorageaffirm = new Clientinstorageaffirm();
for (int i = 0; i < Integer.parseInt(table_row); i++) {
String clientinstorageaffirmid = request.getParameter("clientinstorageaffirmid" + i);
String affirmdate = request.getParameter("affirmdate" + i);
String affirmtime = request.getParameter("affirmtime" + i);
String arrivaltemperature = request.getParameter("arrivaltemperature" + i);

if(clientinstorageaffirmid.equals("") || affirmdate.equals("") || affirmtime.equals("") || arrivaltemperature.equals("")){
System.out.println("批量维护日期时间温度失败!");
return "/indentmanage/instorageaffirm/update";
}else {
clientinstorageaffirm.setClientinstorageaffirmid(Integer.parseInt(clientinstorageaffirmid));
clientinstorageaffirm.setAffirmdate(Date.valueOf(affirmdate));
clientinstorageaffirm.setAffirmtime(affirmtime);
clientinstorageaffirm.setArrivaltemperature(arrivaltemperature);

int k = instorageAffirmService.InstorageAffirm_Update(clientinstorageaffirm);
if(k > 0){
b = true;
}else {
b = false;
}
}
}
if(b == true){
System.out.println("批量维护日期时间温度成功!");
return InstorageAffirmConditionQuery_One(null,null,null,null,null,null,null);
}else{
System.out.println("批量维护日期时间温度失败!");
return "/indentmanage/instorageaffirm/update";
}
}

Jsp层:
<script type="text/javascript">
//点击提交时获取table行数(row-1),传回后台遍历获取此table的值
function Instorageaffirm_Update(){
//获取table总行数
var row = itemtable.rows.length;
$("#table_row").val(row - 1);

}

</script>

<body>
<form id="form1" action="${ctx}/instorageAffirmController/instorageAffirm_Update.do" method="post">
<input type="hidden" name="table_row" id="table_row" />
        <c:forEach items="${map_value}" var="item">         <tr>                  <input type="hidden" name="clientinstorageaffirmid${item.number}" value="${item.clientinstorageaffirmid}" />                <td>${item.outbankindentnumber}</td>                <td><input type="date" name="affirmdate${item.number}" value="${item.affirmdate}" class="table_input_bianji" require="true" dataType="Require" msg="确认日期必填" /></td>                <td><input type="time" name="affirmtime${item.number}" value="${item.affirmtime}" class="table_input_bianji" require="true" dataType="Require" msg="确认时间必填" /></td>                <td><input type="text" name="arrivaltemperature${item.number}" value="${item.arrivaltemperature}" class="table_input_bianji" require="true" dataType="Require" msg="到货温度必填" /></td>                <td>${item.differencequantity}件</td>                <td>${item.differencecause}</td>                <td>                  <c:if test="${item.whetherconfirm == 1}">未确认</c:if>                  <c:if test="${item.whetherconfirm == 2}">已确认</c:if>                </td>              </tr>          </c:forEach>        </table>
</body>

四、卖个小萌

           以后情况允许的话,也会发一些类似的技术博客,有缘看到的话,要关爱我这个小萌新哦,关爱萌新是老司机的责任呀
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  java crm 架构