客户需求:
用户在交易主页面,点击交易名称超级链接,跳转到交易明细页面,完成查看交易明细的功能。
*显示交易的基本信息
*显示交易的备注信息
*显示交易的历史信息
*显示交易的阶段图标信息
功能实现:
1.Tran
TranMapper接口

TranMapper.xml文件
- <select id="selectTranForDetailById" parameterType="string" resultMap="BaseResultMap">
- select
- tt.id, u1.name as owner, tt.money, tt.name, tt.expected_date,tc.name as customer_id,
- tdv.value as stage,tdv2.value as type,tdv3.value as source,ta.name as activity_id,
- tc1.fullname as contacts_id,u2.name as create_by, tt.create_time,u3.name as edit_by, tt.edit_time,
- tt.description, tt.contact_summary,tt.next_contact_time
- from tbl_tran tt
- join tbl_user u1 on tt.owner=u1.id
- join tbl_customer tc on tt.customer_id=tc.id
- join tbl_dic_value tdv on tt.stage=tdv.id
- left join tbl_dic_value tdv2 on tt.type=tdv2.id
- left join tbl_dic_value tdv3 on tt.source=tdv3.id
- left join tbl_activity ta on tt.activity_id=ta.id
- left join tbl_contacts tc1 on tt.contacts_id=tc1.id
- join tbl_user u2 on tt.create_by=u2.id
- left join tbl_user u3 on tt.edit_by=u3.id
- where tt.id=#{id}
- select>
TranService接口

TranServiceImpl实现类

2.TranRemark
TranRemarkMapper接口

TranRemarkMapper.xml文件
- <select id="selectTranRemarkForDetailByTranId" parameterType="string" resultMap="BaseResultMap">
- select trr.id,trr.note_content,u1.name as create_by,trr.create_time,u2.name as edit_by,
- trr.edit_time,trr.edit_flag,tr.name as tran_id
- from tbl_tran_remark trr
- join tbl_user u1 on trr.create_by=u1.id
- left join tbl_user u2 on trr.edit_by=u2.id
- join tbl_tran tr on trr.tran_id=tr.id
- where trr.tran_id=#{tranId}
- select>
TranRemarkService接口

TranRemarkServiceImpl实现类

3.TranHistory
TranHistoryMapper接口

TranHistoryMapper.xml文件
- <select id="selectTranHistoryForDetailByTranId" parameterType="string" resultMap="BaseResultMap">
- select tth.id,tdv.value as stage,tth.money,tth.expected_date,tth.create_time,
- u1.name as create_by,tt.name as tran_id
- from tbl_tran_history tth
- join tbl_dic_value tdv on tth.stage=tdv.id
- join tbl_user u1 on tth.create_by=u1.id
- join tbl_tran tt on tth.tran_id=tt.id
- where tth.tran_id=#{id}
- select>
TranHistoryService接口

TranHistoryServiceImpl实现类

4.TransactionController类
- @RequestMapping("/workbench/transaction/tranDetail.do")
- public String queryTranDetail(String id,HttpServletRequest request){
- //调用service方法,查询数据
- Tran tran = tranService.queryTranForDetailById(id);
- List
tranRemarkList = tranRemarkService.queryTranRemarkForDetailById(id); - List
tranHistories = tranHistoryService.queryTranHistoryForDetailByTranId(id); - //根据交易所处阶段的名称查询可能性
-
- ResourceBundle possibility = ResourceBundle.getBundle("possibility");
- String string = possibility.getString(tran.getStage());
- //把数据保存到request中
- request.setAttribute("tran",tran);
- request.setAttribute("tranRemarkList",tranRemarkList);
- request.setAttribute("tranHistories",tranHistories);
- request.setAttribute("string",string);
- return "workbench/transaction/detail";
- }
5.index.jsp
<td><a style="text-decoration: none; cursor: pointer;" onclick="window.location.href='workbench/transaction/tranDetail.do?id=${tran.id}';">${tran.name}a>td>
detail.jsp
- <%@page contentType="text/html; charset=UTF-8" language="java" %>
- <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
- <%
- String basePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath()+"/";
- %>
- <html>
- <head>
- <meta charset="UTF-8">
- <base href="<%=basePath%>">
- <link href="jquery/bootstrap_3.3.0/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
-
- <style type="text/css">
- .mystage{
- font-size: 20px;
- vertical-align: middle;
- cursor: pointer;
- }
- .closingDate{
- font-size : 15px;
- cursor: pointer;
- vertical-align: middle;
- }
- style>
-
- <script type="text/javascript" src="jquery/jquery-1.11.1-min.js">script>
- <script type="text/javascript" src="jquery/bootstrap_3.3.0/js/bootstrap.min.js">script>
-
- <script type="text/javascript">
-
- //默认情况下取消和保存按钮是隐藏的
- var cancelAndSaveBtnDefault = true;
-
- $(function(){
- $("#remark").focus(function(){
- if(cancelAndSaveBtnDefault){
- //设置remarkDiv的高度为130px
- $("#remarkDiv").css("height","130px");
- //显示
- $("#cancelAndSaveBtn").show("2000");
- cancelAndSaveBtnDefault = false;
- }
- });
-
- $("#cancelBtn").click(function(){
- //显示
- $("#cancelAndSaveBtn").hide();
- //设置remarkDiv的高度为130px
- $("#remarkDiv").css("height","90px");
- cancelAndSaveBtnDefault = true;
- });
-
- $(".remarkDiv").mouseover(function(){
- $(this).children("div").children("div").show();
- });
-
- $(".remarkDiv").mouseout(function(){
- $(this).children("div").children("div").hide();
- });
-
- $(".myHref").mouseover(function(){
- $(this).children("span").css("color","red");
- });
-
- $(".myHref").mouseout(function(){
- $(this).children("span").css("color","#E6E6E6");
- });
-
-
- //阶段提示框
- $(".mystage").popover({
- trigger:'manual',
- placement : 'bottom',
- html: 'true',
- animation: false
- }).on("mouseenter", function () {
- var _this = this;
- $(this).popover("show");
- $(this).siblings(".popover").on("mouseleave", function () {
- $(_this).popover('hide');
- });
- }).on("mouseleave", function () {
- var _this = this;
- setTimeout(function () {
- if (!$(".popover:hover").length) {
- $(_this).popover("hide")
- }
- }, 100);
- });
- });
-
-
-
- script>
-
- head>
- <body>
-
-
- <div style="position: relative; top: 35px; left: 10px;">
- <a href="javascript:void(0);" onclick="window.history.back();"><span class="glyphicon glyphicon-arrow-left" style="font-size: 20px; color: #DDDDDD">span>a>
- div>
-
-
- <div style="position: relative; left: 40px; top: -30px;">
- <div class="page-header">
- <h3>${tran.name} <small>${tran.money}small>h3>
- div>
-
- div>
-
- <br/>
- <br/>
- <br/>
-
-
- <div style="position: relative; left: 40px; top: -50px;">
- 阶段
- <span class="glyphicon glyphicon-ok-circle mystage" data-toggle="popover" data-placement="bottom" data-content="资质审查" style="color: #90F790;">span>
- -----------
- <span class="glyphicon glyphicon-ok-circle mystage" data-toggle="popover" data-placement="bottom" data-content="需求分析" style="color: #90F790;">span>
- -----------
- <span class="glyphicon glyphicon-ok-circle mystage" data-toggle="popover" data-placement="bottom" data-content="价值建议" style="color: #90F790;">span>
- -----------
- <span class="glyphicon glyphicon-ok-circle mystage" data-toggle="popover" data-placement="bottom" data-content="确定决策者" style="color: #90F790;">span>
- -----------
- <span class="glyphicon glyphicon-map-marker mystage" data-toggle="popover" data-placement="bottom" data-content="提案/报价" style="color: #90F790;">span>
- -----------
- <span class="glyphicon glyphicon-record mystage" data-toggle="popover" data-placement="bottom" data-content="谈判/复审">span>
- -----------
- <span class="glyphicon glyphicon-record mystage" data-toggle="popover" data-placement="bottom" data-content="成交">span>
- -----------
- <span class="glyphicon glyphicon-record mystage" data-toggle="popover" data-placement="bottom" data-content="丢失的线索">span>
- -----------
- <span class="glyphicon glyphicon-record mystage" data-toggle="popover" data-placement="bottom" data-content="因竞争丢失关闭">span>
- -----------
- <span class="closingDate">${tran.expectedDate}span>
- div>
-
-
- <div style="position: relative; top: 0px;">
- <div style="position: relative; left: 40px; height: 30px;">
- <div style="width: 300px; color: gray;">所有者div>
- <div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${tran.owner}b>div>
- <div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">金额div>
- <div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${tran.money}b>div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;">div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 10px;">
- <div style="width: 300px; color: gray;">名称div>
- <div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${tran.name}b>div>
- <div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">预计成交日期div>
- <div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${tran.expectedDate}b>div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;">div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 20px;">
- <div style="width: 300px; color: gray;">客户名称div>
- <div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${tran.customerId}b>div>
- <div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">阶段div>
- <div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${tran.stage}b>div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;">div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 30px;">
- <div style="width: 300px; color: gray;">类型div>
- <div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${tran.type}b>div>
- <div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">可能性div>
- <div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${string}b>div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;">div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 40px;">
- <div style="width: 300px; color: gray;">来源div>
- <div style="width: 300px;position: relative; left: 200px; top: -20px;"><b>${tran.source}b>div>
- <div style="width: 300px;position: relative; left: 450px; top: -40px; color: gray;">市场活动源div>
- <div style="width: 300px;position: relative; left: 650px; top: -60px;"><b>${tran.activityId}b>div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px;">div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -60px; left: 450px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 50px;">
- <div style="width: 300px; color: gray;">联系人名称div>
- <div style="width: 500px;position: relative; left: 200px; top: -20px;"><b>${tran.contactsId}b>div>
- <div style="height: 1px; width: 550px; background: #D5D5D5; position: relative; top: -20px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 60px;">
- <div style="width: 300px; color: gray;">创建者div>
- <div style="width: 500px;position: relative; left: 200px; top: -20px;"><b>${tran.createBy} b><small style="font-size: 10px; color: gray;">${tran.createTime}small>div>
- <div style="height: 1px; width: 550px; background: #D5D5D5; position: relative; top: -20px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 70px;">
- <div style="width: 300px; color: gray;">修改者div>
- <div style="width: 500px;position: relative; left: 200px; top: -20px;"><b>${tran.editBy} b><small style="font-size: 10px; color: gray;">${tran.editTime}small>div>
- <div style="height: 1px; width: 550px; background: #D5D5D5; position: relative; top: -20px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 80px;">
- <div style="width: 300px; color: gray;">描述div>
- <div style="width: 630px;position: relative; left: 200px; top: -20px;">
- <b>
- ${tran.description}
- b>
- div>
- <div style="height: 1px; width: 850px; background: #D5D5D5; position: relative; top: -20px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 90px;">
- <div style="width: 300px; color: gray;">联系纪要div>
- <div style="width: 630px;position: relative; left: 200px; top: -20px;">
- <b>
- ${tran.contactSummary}
- b>
- div>
- <div style="height: 1px; width: 850px; background: #D5D5D5; position: relative; top: -20px;">div>
- div>
- <div style="position: relative; left: 40px; height: 30px; top: 100px;">
- <div style="width: 300px; color: gray;">下次联系时间div>
- <div style="width: 500px;position: relative; left: 200px; top: -20px;"><b> ${tran.nextContactTime}b>div>
- <div style="height: 1px; width: 400px; background: #D5D5D5; position: relative; top: -20px;">div>
- div>
- div>
-
-
- <div style="position: relative; top: 100px; left: 40px;">
- <div class="page-header">
- <h4>备注h4>
- div>
-
-
- <c:forEach items="${tranRemarkList}" var="remark">
- <div class="remarkDiv" id="div_${remark.id}" style="height: 60px;">
- <img title="${remark.createBy}" src="image/user-thumbnail.png" style="width: 30px; height:30px;">
- <div style="position: relative; top: -40px; left: 40px;" >
- <h5>${remark.noteContent}h5>
- <font color="gray">交易font> <font color="gray">-font> <b>${tran.name}b> <small style="color: gray;"> ${remark.editFlag=='0'?remark.createTime:remark.editTime} 由${remark.editFlag=='0'?remark.createBy:remark.editBy}${remark.editFlag=='0'?"创建":"修改"}small>
- <div style="position: relative; left: 500px; top: -30px; height: 30px; width: 100px; display: none;">
- <a class="myHref" name="editA" remarkId="${remark.id}" href="javascript:void(0);"><span class="glyphicon glyphicon-edit" style="font-size: 20px; color: #E6E6E6;">span>a>
-
- <a class="myHref" name="deleteA" remarkId="${remark.id}" href="javascript:void(0);"><span class="glyphicon glyphicon-remove" style="font-size: 20px; color: #E6E6E6;">span>a>
- div>
- div>
- div>
- c:forEach>
-
-
-
- <div id="remarkDiv" style="background-color: #E6E6E6; width: 870px; height: 90px;">
- <form role="form" style="position: relative;top: 10px; left: 10px;">
- <textarea id="remark" class="form-control" style="width: 850px; resize : none;" rows="2" placeholder="添加备注...">textarea>
- <p id="cancelAndSaveBtn" style="position: relative;left: 737px; top: 10px; display: none;">
- <button id="cancelBtn" type="button" class="btn btn-default">取消button>
- <button type="button" class="btn btn-primary">保存button>
- p>
- form>
- div>
- div>
-
-
- <div>
- <div style="position: relative; top: 100px; left: 40px;">
- <div class="page-header">
- <h4>阶段历史h4>
- div>
- <div style="position: relative;top: 0px;">
- <table id="activityTable" class="table table-hover" style="width: 900px;">
- <thead>
- <tr style="color: #B3B3B3;">
- <td>阶段td>
- <td>金额td>
- <td>预计成交日期td>
- <td>创建时间td>
- <td>创建人td>
- tr>
- thead>
- <tbody>
- <c:forEach items="${tranHistories}" var="th">
- <tr>
- <td>${th.stage}td>
- <td>${th.money}td>
- <td>${th.expectedDate}td>
- <td>${th.createTime}td>
- <td>${th.createBy}td>
- tr>
- c:forEach>
- tbody>
- table>
- div>
-
- div>
- div>
-
- <div style="height: 200px;">div>
-
- body>
- html>
功能测试
