Commit 299a646f authored by 黎聪聪's avatar 黎聪聪

订单,订单明细,报表

parent f3d47134
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>order-detail-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<groupId>com.cftech</groupId>
<packaging>war</packaging>
<name>order-detail-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-detail-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>order-detail-module-web</finalName>
</build>
</project>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
订单管理管理
<small>订单管理</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">订单管理</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
<div class="form-group form-md-line-input">
<label>订单编号<font style="color: red"></font></label>
<input type="text"
class="form-control" name="orderCode"
id="orderCode" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.orderCode}"
>
<label>商品编码<font style="color: red"></font></label>
<input type="text"
class="form-control" name="drugsCode"
id="drugsCode" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.drugsCode}"
>
<label>商品名称<font style="color: red"></font></label>
<input type="text"
class="form-control" name="productName"
id="productName" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.productName}"
><label>商品价格<font style="color: red"></font></label>
<input type="text"
class="form-control" name="price"
id="price" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.price}"
>
<label>商品数量<font style="color: red"></font></label>
<input type="text"
class="form-control" name="drugsNum"
id="drugsNum" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.drugsNum}"
>
<label>商品总价<font style="color: red"></font></label>
<input type="text"
class="form-control" name="amount"
id="amount" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.amount}"
>
<label>商品规格<font style="color: red"></font></label>
<input type="text"
class="form-control" name="drugsSku"
id="drugsSku" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.drugsSku}"
>
<label>创建时间<font style="color: red"></font></label>
<input type="text"
class="form-control" name="createTime"
id="createTime" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.createTime}"
>
<label>erp物料号<font style="color: red"></font></label>
<input type="text"
class="form-control" name="drugsMateriel"
id="drugsMateriel" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.drugsMateriel}"
>
</div>
</div>
<div class="box-footer">
<!-- #if($shiro.hasPermission("qy:orderDetails:edit"))-->
<!-- <input class="btn btn-primary" id="save" value="保存" type="submit">-->
<!-- #end-->
<a href="#springUrl('/a/orderDetails/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/orderDetails/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/orderDetails/form')";
},
cancel: function () {
location.href = "#springUrl('/a/orderDetails/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/orderDetails/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/orderDetails/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Morris chart -->
<link rel="stylesheet" href="plugins/morris/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<link rel="stylesheet"
href="plugins\bootstrap-fileinput\fileinput.min.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<div id="importExcelDiv"></div>
<section class="content-header">
<h1>
订单管理管理
<small>订单管理</small>
</h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">订单管理管理列表</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/orderDetails/list')" method="get">
<div class="col-xs-5">
<div class="col-xs-2" >
<input type="text" class="form-control required"
id="orderCode" name="orderCode" placeholder="订单编码">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control required"
id="drugsCode" name="drugsCode" placeholder="商品编码">
</div>
<button type="button" class="search btn btn-primary">搜索</button>
<!-- #if($shiro.hasPermission("qy:orderDetails:edit"))-->
<!-- <a href="#springUrl('/a/orderDetails/form')" class="btn btn-primary">新增</a>-->
<!-- <a href="#springUrl('/a/orderDetails/exportExcel')" class="btn btn-primary">导出</a>-->
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
<!-- #end-->
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td>
<th>订单编码</th>
<th>商品编码</th>
<th>商品名称</th>
<th>商品价格</th>
<th>商品数量</th>
<th>商品总价</th>
<th>商品规格</th>
<th>创建时间</th>
<th>erp物料号</th>
<th>操作</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
function formatDates(now) {
var now = new Date(now);
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":"
+ minute + ":" + second;
}
function seachTable() {
var sSource = "#springUrl('/a/orderDetails/listData')";
var aoData = {
iDisplayStart: 1,
iDosplayLength: 10
}
var retrieveData = function (sSource, aoData, fnCallback) {
$("#seachTableForm input").each(function () {
var params = {
name: $(this).attr("name"),
value: $(this).val()
};
aoData.push(params);
})
$.ajax({
"type": "GET",
"url": sSource,
"dataType": "json",
"data": aoData, //以json格式传递
"success": fnCallback
});
};
$('#table').DataTable({
"lengthChange": false,
"searching": false,
"ordering": false,
"bFiltered": false,
"bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": sSource,
"fnServerData": retrieveData,
"pagingType": "full_numbers",
"aoColumns": [
{
"mData": "id"
},
{
"mData": "orderCode"
}
,
{
"mData": "drugsCode"
},
{
"mData": "productName"
},
{
"mData": "price"
}
,
{
"mData": "drugsNum"
},
{
"mData": "amount"
},
{
"mData": "drugsSku"
},
{
"mData": "createTime"
}
,
{
"mData": "drugsMateriel"
}
,
{
"mData": "id"
}],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets": [1],
"mData": "orderCode",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [2],
"mData": "drugsCode",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [3],
"mData": "productName",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [4],
"mData": "price",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [5],
"mData": "drugsNum",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [6],
"mData": "amount",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [7],
"mData": "drugsSku",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [8],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [9],
"mData": "drugsMateriel",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [10],
"mData": "id",
"mRender": function (a, b, c, d) {
var html = '#if($shiro.hasPermission("qy:orderDetails:edit"))';
html += '<div class="btn-group">\n' +
'<button type="button" class="btn btn-success btn-flat">操作</button>\n' +
'<button type="button" class="btn btn-success btn-flat dropdown-toggle" data-toggle="dropdown">\n' +
' <span class="caret"></span>\n' +
' <span class="sr-only">Toggle Dropdown</span>\n' +
'</button>\n' +
'<ul class="dropdown-menu" role="menu">\n';
html += '<li><a href="#springUrl("/a/orderDetails/form?id=' + a + '")">查看</a></li>';
html += '<li><a href="javascript:removeData(' + a + ')">删除</a></li>';
html += '</ul>';
html += '#end';
return html;
}
}
]
});
}
jQuery(document).ready(function () {
seachTable();
$('.datepicker').datepicker({
show: true,
format: 'yyyy-mm-dd',
autoclose: true,
language: 'zh-CN',
todayBtn: 'linked',
clearBtn: 'linked'
});
$('.search').click(function () {
$("#table").dataTable().fnClearTable();
});
});
Cfapp.init();
function removeData(data) {
Cfapp.confirm({
message: "确定要删除吗",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
$.ajax({
type: "POST",
url: "#springUrl('/a/orderDetails/delete')",
data: {id: data},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/orderDetails/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function importExcel() {
var templateExcelUrl = "#springUrl('/a/orderDetails/templateExcel')";
var importExcelUrl = "#springUrl('/a/orderDetails/importExcel')";
Cfapp.importExcel({
title: '订单管理导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function () {
}
});
}
</script>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>order-detail-module</artifactId>
</project>
\ No newline at end of file
package com.cftech.orderdetail.dao;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.core.generic.GenericDao;
/**
* 订单管理Mapper
*
* @author Licc
* @date: 2020-10-16 11:26
*/
public interface OrderDetailsMapper extends GenericDao<OrderDetails> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cftech.orderdetail.dao.OrderDetailsMapper">
<resultMap id="resultMap" type="com.cftech.orderdetail.model.OrderDetails">
<id column="id" property="id"/>
<result column="order_id" property="orderId"/>
<result column="order_code" property="orderCode"/>
<result column="drugs_id" property="drugsId"/>
<result column="drugs_num" property="drugsNum"/>
<result column="openid" property="openid"/>
<result column="price" property="price"/>
<result column="amount" property="amount"/>
<result column="drugs_code" property="drugsCode"/>
<result column="drugs_sku" property="drugsSku"/>
<result column="drugs_materiel" property="drugsMateriel"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
<result column="product_name" property="productName"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
d.id,
d.order_id,
d.order_code,
d.drugs_id,
d.drugs_num,
d.openid,
d.price,
d.amount,
d.drugs_code,
d.drugs_sku,
d.drugs_materiel,
d.accounts_id,
d.del_flag,
d.STATUS,
d.create_time,
d.update_time,
d.description,
d.create_by,
d.update_by,
p.product_name
</sql>
<insert id="save" parameterType="com.cftech.orderdetail.model.OrderDetails" useGeneratedKeys="true"
keyProperty="id">
insert into t_order
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{orderId, jdbcType=BIGINT},
#{orderCode, jdbcType=VARCHAR},
#{drugsId, jdbcType=BIGINT},
#{drugsNum, jdbcType=BIGINT},
#{openid, jdbcType=VARCHAR},
#{price, jdbcType=CHAR},
#{amount, jdbcType=CHAR},
#{drugsCode, jdbcType=CHAR},
#{drugsSku, jdbcType=VARCHAR},
#{drugsMateriel, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
WHERE d.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_order_details d
LEFT JOIN t_aidea_product p ON p.id = d.drugs_id
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.orderdetail.model.OrderDetails">
update t_order
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="orderId != null">
order_id = #{orderId, jdbcType=BIGINT},
</if>
<if test="orderCode != null">
order_code = #{orderCode, jdbcType=VARCHAR},
</if>
<if test="drugsId != null">
drugs_id = #{drugsId, jdbcType=BIGINT},
</if>
<if test="drugsNum != null">
drugs_num = #{drugsNum, jdbcType=BIGINT},
</if>
<if test="openid != null">
openid = #{openid, jdbcType=VARCHAR},
</if>
<if test="price != null">
price = #{price, jdbcType=CHAR},
</if>
<if test="amount != null">
amount = #{amount, jdbcType=CHAR},
</if>
<if test="drugsCode != null">
drugs_code = #{drugsCode, jdbcType=CHAR},
</if>
<if test="drugsSku != null">
drugs_sku = #{drugsSku, jdbcType=VARCHAR},
</if>
<if test="drugsMateriel != null">
drugs_materiel = #{drugsMateriel, jdbcType=VARCHAR},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_order set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.orderdetail.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单管理
*
* @author Licc
* @date: 2020-10-16 11:26
*/
@Data
public class OrderDetails implements Serializable {
/* 主键id */
private Long id;
/* 订单id */
@ExportConfig(value = "订单id", width = 100, showLevel = 1)
private Long orderId;
/* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode;
/* 商品id */
@ExportConfig(value = "商品id", width = 100, showLevel = 1)
private Long drugsId;
/* 商品数量 */
@ExportConfig(value = "商品数量", width = 100, showLevel = 1)
private Long drugsNum;
/* 用户所属公众号id */
@ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1)
private String openid;
/* 商品价格 */
@ExportConfig(value = "商品价格", width = 100, showLevel = 1)
private Double price;
/* 商品总价 */
@ExportConfig(value = "商品总价", width = 100, showLevel = 1)
private Double amount;
/* 商品编码 */
@ExportConfig(value = "商品编码", width = 100, showLevel = 1)
private String drugsCode;
/* 商品sku(规格) */
@ExportConfig(value = "商品sku(规格)", width = 100, showLevel = 1)
private String drugsSku;
/* 对应erp物料号 */
@ExportConfig(value = "对应erp物料号", width = 100, showLevel = 1)
private String drugsMateriel;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
private String productName;
public OrderDetails() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.orderdetail.service;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.core.generic.GenericService;
/**
* 订单管理Service
*
* @author Licc
* @date: 2020-10-16 11:26
*/
public interface OrderDetailsService extends GenericService<OrderDetails> {
}
package com.cftech.orderdetail.service.impl;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.orderdetail.dao.OrderDetailsMapper;
import com.cftech.orderdetail.service.OrderDetailsService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 订单管理ServiceImpl
*
* @author Licc
* @date: 2020-10-16 11:26
*/
@Service("orderDetailsService")
public class OrderDetailsServiceImpl extends GenericServiceImpl<OrderDetails> implements OrderDetailsService {
@Autowired
@Qualifier("orderDetailsMapper")
private OrderDetailsMapper orderDetailsMapper;
@Override
public GenericDao<OrderDetails> getGenericMapper() {
return orderDetailsMapper;
}
}
\ No newline at end of file
package com.cftech.orderdetail.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.orderdetail.model.OrderDetails;
import com.cftech.orderdetail.service.OrderDetailsService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 订单管理Controller
* <p>
* 权限字符串说明:
* 查看:public static final String ORDERDETAILS_VIEW = "qy:orderDetails:view"
* 查看:public static final String ORDERDETAILS_EDIT = "qy:orderDetails:edit"
*
* @author Licc
* @date: 2020-10-16 11:26
*/
@Slf4j
@Controller
@RequestMapping("/a/orderDetails")
public class OrderDetailsController {
public static final String ORDERDETAILS_VIEW = "qy:orderDetails:view";
public static final String ORDERDETAILS_EDIT = "qy:orderDetails:edit";
@Autowired
private OrderDetailsService orderDetailsService;
//列表页面
@RequiresPermissions(value = ORDERDETAILS_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "orderDetails/orderDetailslist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = ORDERDETAILS_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
OrderDetails orderDetails = orderDetailsService.fetchById(id);
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(orderDetails));
model.addAttribute("data", jsonObject);
}
return "orderDetails/orderDetailsform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = ORDERDETAILS_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(OrderDetails orderDetails, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (orderDetails != null && orderDetails.getId() != null) {
orderDetails.setUpdateBy(UserUtils.getUser().getId());
orderDetailsService.update(orderDetails);
rtnJson.put("errorNo", 0);
} else {
orderDetails.setAccountsId(accountsId);
orderDetails.setDelFlag(false);
orderDetails.setAccountsId(UserUtils.getmpaccounts(request));
orderDetails.setCreateBy(UserUtils.getUser().getId());
orderDetails.setUpdateBy(UserUtils.getUser().getId());
orderDetailsService.save(orderDetails);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = ORDERDETAILS_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, OrderDetails orderDetails, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("d.del_flag", Constants.DEL_FLAG_0);
conds.equal("d.accounts_id", accountsId);
conds.like("d.order_code",orderDetails.getOrderCode());
conds.like("d.drugs_code",orderDetails.getDrugsCode());
Sort sort = new Sort("d.create_time", OrderType.DESC);
List<OrderDetails> list = orderDetailsService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = orderDetailsService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = ORDERDETAILS_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
orderDetailsService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = ORDERDETAILS_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", accountId);
List<OrderDetails> list = orderDetailsService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(OrderDetails.class, response).toExcel(list, "订单管理信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = ORDERDETAILS_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(OrderDetails.class, response).toExcel(null, "订单管理信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = ORDERDETAILS_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
OrderDetails orderDetails = new OrderDetails();
orderDetails.setAccountsId(accountId);
orderDetailsService.save(orderDetails);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>order-module-web</artifactId>
<groupId>com.cftech</groupId>
<packaging>war</packaging>
<name>order-module-web Maven Webapp</name>
<version>1.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>order-module-web</finalName>
</build>
</project>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
订单管理管理
<small>订单管理</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">订单管理</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input id="id" name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
<div class="form-group form-md-line-input">
<label>订单编码<font style="color: red"></font></label>
<input type="text"
class="form-control" name="orderCode"
id="orderCode" readonly="readonly"
maxlength="50" placeholder="订单编码"
value="$!{data.orderCode}"
>
<label>快递单号<font style="color: red"></font></label>
<input type="text"
class="form-control" name="courierNumber"
id="courierNumber" readonly="readonly"
maxlength="50" placeholder="快递单号"
value="$!{data.courierNumber}"
>
<label>商品编码<font style="color: red"></font></label>
<input type="text"
class="form-control" name="productNumber"
id="productNumber" readonly="readonly"
maxlength="50" placeholder="商品编码"
value="$!{data.productNumber}"
>
<br/>
<div id="group" class="group">
<th style="width:15%; "><label
style="margin-right: 210px ; margin-left: 50px">商品名称</label></th>
<th style="width:45%;"><label style="margin-right: 210px">商品购买数量</label>
</th>
<th style="width:30%;"><label style="margin-right: 210px">商品单价</label></th>
<th style="width:30%;"><label>商品总价</label></th>
</div>
<br/>
<button type="button" class="search btn btn-primary" onclick="clickAdd()">添加商品和数量
</button>
<br/><br/>
<label>订单总价<font style="color: red"></font></label>
<input type="text"
class="form-control" name="orderAmount"
id="orderAmount" readonly="readonly"
maxlength="50" placeholder="订单金额"
value="$!{data.orderAmount}"
> <label>收货地址<font style="color: red"></font></label>
<input type="text"
class="form-control" name="address"
id="address" readonly="readonly"
maxlength="50" placeholder="收货地址"
value="$!{data.address}"
>
<label>订单状态<font style="color: red"></font></label>
<input type="text"
class="form-control" name="payStatus"
id="payStatus" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.payStatus}"
>
<label>支付备注<font style="color: red"></font></label>
<input type="text"
class="form-control" name="description"
id="description" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.description}"
>
<label>支付交易号<font style="color: red"></font></label>
<input type="text"
class="form-control" name="tradeNo"
id="tradeNo" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.tradeNo}"
>
<label>创建时间<font style="color: red"></font></label>
<input type="text"
class="form-control" name="createTime"
id="createTime" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.createTime}"
>
<label>用户是否确认<font style="color: red"></font></label>
<input type="text"
class="form-control" name="confirm"
id="confirm" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.confirm}"
>
<div id="divClass">
<label>订单取消原因<font style="color: red"></font></label>
<input type="text"
class="form-control" name="orderCancel"
id="orderCancel" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.orderCancel}"
>
</div>
<div/>
<div class="box-footer">
#if($shiro.hasPermission("qy:order:edit"))
<button class="btn btn-primary" onclick="save()">保存</button>
#end
<a href="#springUrl('/a/order/list')" class="btn btn-default">取消</a>
</div>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
var csrf='${_csrf.token}';
var csrf_header='${_csrf.headerName}';
var areaList;
function list() {
var url = "#springUrl('/a/order/fromProduct')"
$.ajax({
url: url,
type: "GET",
success: function (data) {
console.log(data)
areaList = data
// var province = document.querySelector('#selectProduct')
// for (index in areaList) {
// var op = new Option(areaList[index].productName, areaList[index].id, false, false)
// province.options[province.length] = op
// }
var provinceId = '$!{data.productId}';
var selectProductList = '$!{list}';
if (selectProductList != null && selectProductList != '') {
selectProductList = JSON.parse(selectProductList);
for (var i = 0; i < selectProductList.length; i++) {
var obj = selectProductList[i];
// if($(this).val() == obj.provinceId){
// $(this).attr('selected', 'selected');
// }
clickAdd(obj.productId, obj.drugsNum, obj.price, obj.amount);
}
}
// $('#selectProduct option').each(function () {
// for(var index= 0;i<selectProductList.length;i++){
// var obj = selectProductList[i];
// if($(this).val() == obj.provinceId){
// $(this).attr('selected', 'selected');
// }
// }
//
// })
}
});
}
$().ready(function () {
$("#divClass").css('display', 'none')
var payStatus = $("#payStatus").val();
if (payStatus == '0') {
$("#payStatus").val("未付款");
} else if (payStatus == '1') {
$("#payStatus").val("已付款");
} else if (payStatus == '2') {
$("#payStatus").val("已取消");
} else {
$("#payStatus").val("");
}
var confirm = $("#confirm").val();
if (confirm == '0') {
$("#confirm").val("待确认");
} else if (confirm == '0') {
$("#confirm").val("已确认");
} else if (confirm == '0') {
$("#confirm").val("已取消");
} else {
$("#confirm").val("");
}
var confirm = $("#confirm").val();
if (confirm = '0') {
$("#divClass").css('display', 'blocks')
}
Cfapp.init();
list();
// var selectdrugsNum = $("#selectdrugsNum");
// for (var i = 1; i <=30; i ++){
// selectdrugsNum.append("<option value='"+[i]+"'>"+[i]+"</option>")
// }
// var drugsNum = "$!{data.drugsNum}";
// $('#selectdrugsNum option').each(function () {
// if($(this).val() == drugsNum){
// $(this).attr('selected', 'selected');
// }
// })
});
function clickAdd(id, count, price, amount) {
var options = areaList.map(function (item) {
if (id && id != null && item.id === id) {
return `<option selected value="${item.id}" data-price="${item.price}">${item.productName}</option>`
} else {
return `<option value="${item.id}" data-price="${item.price}">${item.productName}</option>`
}
}).join('')
console.log(options);
var listHtml = "";
if (count && count != null) {
listHtml += `<input name="listHtml" type='number' oninput="if(value>100)value=100;if(value.length>2)value=value.slice(0,2);if(value<=0)value=1" onchange="updateCount(this)" value=${count} ></input>`;
} else {
listHtml += `<input name="listHtml" type='number' oninput="if(value>100)value=100;if(value.length>2)value=value.slice(0,2);if(value<=0)value=1" onchange="updateCount(this)" value="1"></input>`;
}
var HtmlPrice = "";
if (price && price != null) {
HtmlPrice += `<input name="htmlPrice" style="margin-left: 100px" type='text' readonly="readonly" value=${price} ></input>`;
} else {
// var item = areaList.find(item => item.id === id)
var item = areaList[0]
HtmlPrice += `<input name="htmlPrice" data-price="${item.id}" style="margin-left: 100px" type="text" readonly="readonly" value="${item.price}"></input>`
}
var HtmlAmount = "";
if (amount && amount != null) {
HtmlAmount += `<input id="htmlAmount" name="htmlAmount" style="margin-left: 100px" type='text' readonly="readonly" value=${amount} ></input>`;
} else {
// var item = areaList.find(item => item.id === id)
var countSi = 1;
var amountPrice = countSi * item.price
var item = areaList[0]
HtmlAmount += `<input id="htmlAmount" name="htmlAmount" data-price="${item.id}" style="margin-left: 100px" type="text" readonly="readonly" value="${amountPrice}"></input>`
}
let html = `<br/> <div id="form-translate" class="translate" style="display: flex">
<select class="form-control" name="releas" style="width: 180px ;margin-right: 80px" onchange="getPrice(this)">
${options}
</select>
${listHtml}
${HtmlPrice}
${HtmlAmount}
<button type="button" class="search btn btn-primary" style="background-color: #d73925 ;margin-left: 200px" onclick="deleteSelect(event)">删除
</button>
</div>`
$("#group").append(html);
toTal()
}
function getPrice(e) {
let price = $(e).find("option:selected").attr('data-price');
//let price = $(e).parent().find('input[name="htmlPrice"]').attr("target-data");
$(e).parent().find('input[name="htmlPrice"]').val(price);
let value = $(e).parent().find('input[name="htmlPrice"]').val()
let count = $(e).parent().find('input[name="listHtml"]').val()
let val = value * count;
$(e).parent().find('input[name="htmlAmount"]').val(val)
// let htmlAmount = $(e).parent().find('input[name="htmlAmount"]').val()
toTal()
}
function updateCount(value) {
var price = $(value).parent().find('input[name="htmlPrice"]').val()
var valueSi = $(value).val()
var totalPrice = valueSi * price;
$(value).parent().find('input[name="htmlAmount"]').val(totalPrice)
toTal()
}
function updatePrice(e) {
// var orderAmount = $("#orderAmount");
var valueSi = $(value).val();
$("#orderAmount").val(valueSi);
}
function deleteSelect(event) {
var dom = event.target;
var ret = $(dom);
ret.parent().remove();
toTal()
}
function toTal() {
var count = 0
$('.group [name="htmlAmount"]').each(function(index, item){
count += +item.value
})
$("#orderAmount").val(count);
}
function save() {
$('.group [name="form-control"]').each(function (item) {
})
var id = $("#id").val()
var orderAmount = $("#orderAmount").val()
var datas = [];
$('.translate').each(function (index,item){
const productId = $(item).find('[name="releas"]').val()
const drugsNum = $(item).find('[name="listHtml"]').val()
const price = $(item).find('[name="htmlPrice"]').val()
const amount = $(item).find('[name="htmlAmount"]').val()
console.log(item)
datas.push({
id : id,
productId :productId,
drugsNum : drugsNum,
price : price,
amount : amount,
orderAmount :orderAmount
})
})
var url = "#springUrl('/a/order/formData')"
$.ajax({
url: url,
type: "POST",
data : {_csrf:csrf,_csrf_header:csrf_header,"datas":JSON.stringify(datas)},
success :function (rsp) {
if(rsp.aaData == 1){
Cfapp.alert({
message: "修改成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/order/list')";
}
});
}else{
Cfapp.alert({
message: "修改失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/order/from')";
}
});
}
}
})
}
// var recdTypeAdd = function () {
// var initForm = function () {
// var initFormCtrl = function () {
// bindEvent();
// };
// var bindEvent = function () {
//
// $("#myForm").validate({
// rules: {},
// messages: {},
// submitHandler: function (form) {
// $("#save").attr("disabled", true);
// $.getJSON("#springUrl('/a/order/formData')", $("#myForm").serialize(), function (returnobj) {
// $("#save").attr("disabled", false);
// if (returnobj.errorNo == 2) { //保存成功
// Cfapp.confirm({
// message: "添加成功",
// btnoktext: "继续添加",
// btncanceltext: "关闭",
// success: function () {
// location.href = "#springUrl('/a/order/form')";
// },
// cancel: function () {
// location.href = "#springUrl('/a/order/list')";
// }
// });
// } else if (returnobj.errorNo == 0) { //修改成功
// Cfapp.alert({
// message: "更新成功",
// btntext: "确定",
// success: function () {
// location.href = "#springUrl('/a/order/list')";
// }
// });
// } else {
// Cfapp.alert({
// message: "创建失败",
// btntext: "确定",
// success: function () {
// location.href = "#springUrl('/a/order/list')";
// }
// });
// }
// });
// }
// })
// }
// initFormCtrl();
// }
// return {
//
// //main function to initiate the module
// init: function () {
// initForm();
// }
//
// };
// }();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Morris chart -->
<link rel="stylesheet" href="plugins/morris/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<link rel="stylesheet"
href="plugins\bootstrap-fileinput\fileinput.min.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<div id="importExcelDiv"></div>
<section class="content-header">
<h1>
订单管理管理
<small>订单管理</small>
</h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">订单管理管理列表</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/order/list')" method="get">
<div class="col-xs-5" style="width: 1400px">
<div class="col-xs-2" style=" display: flex">
<input style="width: 100px" type="text" class="form-control required"
name="orderCode" placeholder="订单编号">
&nbsp;&nbsp;
<input style="width: 100px" type="text" class="form-control required"
name="productName" placeholder="产品名称">
</div>
<button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:order:edit"))
<!-- <a href="#springUrl('/a/order/form')" class="btn btn-primary">新增</a>-->
<a href="#springUrl('/a/order/exportExcel')" class="btn btn-primary">导出</a>
#end
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td>
<th>订单编码</th>
<th>产品名称</th>
<th>订单金额</th>
<th>订单总价</th>
<th>收货地址</th>
<th>快递单号</th>
<th>订单状态</th>
<th>支付交易号</th>
<th>支付备注</th>
<th>创建时间</th>
<th>用户是否确认</th>
<th>操作</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
function formatDates(now) {
var now = new Date(now);
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":"
+ minute + ":" + second;
}
function seachTable() {
var sSource = "#springUrl('/a/order/listData')";
var aoData = {
iDisplayStart: 1,
iDosplayLength: 10
}
var retrieveData = function (sSource, aoData, fnCallback) {
$("#seachTableForm input").each(function () {
var params = {
name: $(this).attr("name"),
value: $(this).val()
};
aoData.push(params);
})
$.ajax({
"type": "GET",
"url": sSource,
"dataType": "json",
"data": aoData, //以json格式传递
"success": fnCallback
});
};
$('#table').DataTable({
"lengthChange": false,
"searching": false,
"ordering": false,
"bFiltered": false,
"bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": sSource,
"fnServerData": retrieveData,
"pagingType": "full_numbers",
"aoColumns": [
{
"mData": "id"
},
{
"mData": "orderCode"
},
{
"mData": "productName"
}
,
{
"mData": "payAmount"
}
,
{
"mData": "orderAmount"
}
,
{
"mData": "address"
}
,
{
"mData": "courierNumber"
}
,
{
"mData": "payStatus"
}
,
{
"mData": "tradeNo"
}
,
{
"mData": "description"
}
,
{
"mData": "createTime"
}
,
{
"mData": "confirm"
}
,
{
"mData": "id"
}
],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets": [1],
"mData": "orderCode",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [2],
"mData": "productName",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [3],
"mData": "payAmount",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [4],
"mData": "orderAmount",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [5],
"mData": "address",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [6],
"mData": "courierNumber",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [7],
"mData": "payStatus",
"mRender": function (a, b, c, d) {
if (a=='0'){
return "未付款";
}else if (a=='1'){
return "已付款";
} else if (a=='2'){
return "已取消";
} else{
return "";
}
}
},
{
"aTargets": [8],
"mData": "tradeNo",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [9],
"mData": "description",
"mRender": function (a, b, c, d) {
return a;
}
}
,
{
"aTargets": [10],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return formatDates(a);
}
}
,
{
"aTargets": [11],
"mData": "confirm",
"mRender": function (a, b, c, d) {
if (a=='0'){
return "待确认";
}else if (a=='1'){
return "已确认";
} else if (a=='2'){
return "已取消";
} else{
return "";
}
}
}
,
{
"aTargets": [12],
"mData": "id",
"mRender": function (a, b, c, d) {
var html = '#if($shiro.hasPermission("qy:order:edit"))';
html += '<div class="btn-group">\n' +
'<button type="button" class="btn btn-success btn-flat">操作</button>\n' +
'<button type="button" class="btn btn-success btn-flat dropdown-toggle" data-toggle="dropdown">\n' +
' <span class="caret"></span>\n' +
' <span class="sr-only">Toggle Dropdown</span>\n' +
'</button>\n' +
'<ul class="dropdown-menu" role="menu">\n';
html += '<li><a href="#springUrl("/a/order/form?id=' + a + '")">查看</a></li>';
html += '<li><a href="javascript:removeData(' + a + ')">删除</a></li>';
html += '</ul>';
html += '#end';
return html;
}
}
]
});
}
jQuery(document).ready(function () {
seachTable();
$('.datepicker').datepicker({
show: true,
format: 'yyyy-mm-dd',
autoclose: true,
language: 'zh-CN',
todayBtn: 'linked',
clearBtn: 'linked'
});
$('.search').click(function () {
$("#table").dataTable().fnClearTable();
});
});
Cfapp.init();
function removeData(data) {
Cfapp.confirm({
message: "确定要删除吗",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
$.ajax({
type: "POST",
url: "#springUrl('/a/order/delete')",
data: {id: data},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/order/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function importExcel() {
var templateExcelUrl = "#springUrl('/a/order/templateExcel')";
var importExcelUrl = "#springUrl('/a/order/importExcel')";
Cfapp.importExcel({
title: '订单管理导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function () {
}
});
}
</script>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>order-module</artifactId>
</project>
\ No newline at end of file
package com.cftech.order.dao;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.order.model.*;
import com.cftech.core.generic.GenericDao;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
* 订单管理Mapper
*
* @author Licc
* @date: 2020-10-10 14:20
*/
public interface OrderMapper extends GenericDao<Order> {
List<Order> fetchSearchBy(Conds conds, Sort sort, int page, int pageSize , Long id);
List<ProductOrder> listProduct();
OrderFromVO fetchId(Serializable id);
List<OrderFromVO> fetchProductId(Serializable id);
ProductDto fetchProduct(Map<String, Object> params);
Long saveDetill(OrderDetail orderDetail);
Long fetcheDeta(Map<String, Object> params);
Long updateDetill(Map<String, Object> params);
Order fetchOrder(Long id);
Long updateOrder(Map<String, Object> params);
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cftech.order.dao.OrderMapper">
<resultMap id="resultMap" type="com.cftech.order.model.Order">
<id column="id" property="id"/>
<result column="order_code" property="orderCode"/>
<result column="consult_id" property="consultId"/>
<result column="number" property="number"/>
<result column="member_id" property="memberId"/>
<result column="service_id" property="serviceId"/>
<result column="doctor_id" property="doctorId"/>
<result column="openid" property="openid"/>
<result column="pay_status" property="payStatus"/>
<result column="pay_amount" property="payAmount"/>
<result column="order_amount" property="orderAmount"/>
<result column="total_amount" property="totalAmount"/>
<result column="pay_time" property="payTime"/>
<result column="trade_no" property="tradeNo"/>
<result column="remarks" property="remarks"/>
<result column="order_cancel" property="orderCancel"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
<result column="confirm" property="confirm"/>
<result column="drugs_num" property="drugsNum"/>
<result column="product_number" property="productNumber"/>
<result column="product_name" property="productName"/>
<result column="address" property="address"/>
<result column="courier_number" property="courierNumber"/>
</resultMap>
<resultMap id="resultMapList" type="com.cftech.order.model.Order">
<id column="id" property="id"/>
<result column="order_code" property="orderCode"/>
<result column="consult_id" property="consultId"/>
<result column="number" property="number"/>
<result column="member_id" property="memberId"/>
<result column="service_id" property="serviceId"/>
<result column="doctor_id" property="doctorId"/>
<result column="openid" property="openid"/>
<result column="pay_status" property="payStatus"/>
<result column="pay_amount" property="payAmount"/>
<result column="order_amount" property="orderAmount"/>
<result column="total_amount" property="totalAmount"/>
<result column="pay_time" property="payTime"/>
<result column="trade_no" property="tradeNo"/>
<result column="remarks" property="remarks"/>
<result column="order_cancel" property="orderCancel"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
<result column="confirm" property="confirm"/>
<result column="drugs_num" property="drugsNum"/>
<result column="product_number" property="productNumber"/>
<result column="product_name" property="productName"/>
<result column="address" property="address"/>
<result column="courier_number" property="courierNumber"/>
<collection property="list" ofType="com.cftech.order.model.ProductVO">
<result column="product_name" property="productName"/>
</collection>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
o.id,
o.order_code,
t.product_number,
o.consult_id,
t.product_name,
o.number,
o.pay_amount,
o.order_amount,
o.pay_status,
o.order_cancel,
o.trade_no,
o.description,
o.STATUS,
o.create_time,
o.update_time,
o.confirm,
d.drugs_num,
o.courier_number,
CONCAT(a.areaname,
b.areaname,
c.areaname,s.address) as address,
t.id as productId
</sql>
<sql id="sqlColumnFrom">
o.id,
o.order_code AS orderCode,
o.consult_id AS consultId,
o.number,
o.pay_amount AS payAmount,
o.order_amount AS orderAmount,
o.pay_status AS payStatus,
o.order_cancel AS orderCancel,
o.trade_no AS tradeNo,
o.description,
o.STATUS,
o.create_time AS createTime,
o.confirm,
o.courier_number AS courierNumber,
CONCAT( a.areaname, b.areaname, c.areaname, s.address ) AS address
</sql>
<sql id="sqlColumnProduct">
d.order_id,
t.product_number AS productNumber,
t.product_name AS productName,
t.id AS productId,
d.drugs_num AS drugsNum,
d.price,
d.amount
</sql>
<sql id="Column">
id,
order_id,
order_code,
drugs_id,
drugs_num,
openid,
price,
amount,
drugs_code,
drugs_sku,
drugs_materiel,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.order.model.Order" useGeneratedKeys="true"
keyProperty="id">
insert into t_order
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{consultId, jdbcType=BIGINT},
#{number, jdbcType=VARCHAR},
#{memberId, jdbcType=BIGINT},
#{serviceId, jdbcType=BIGINT},
#{doctorId, jdbcType=BIGINT},
#{openid, jdbcType=VARCHAR},
#{payStatus, jdbcType=BIGINT},
#{payAmount, jdbcType=DECIMAL},
#{orderAmount, jdbcType=DECIMAL},
#{totalAmount, jdbcType=DECIMAL},
now(),
#{tradeNo, jdbcType=VARCHAR},
#{remarks, jdbcType=VARCHAR},
#{orderCancel, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchId" parameterType="java.lang.Long" resultType="com.cftech.order.model.OrderFromVO">
SELECT
<include refid="sqlColumnFrom"/>
from
t_order o
LEFT JOIN t_shipping_address s ON o.address_id = s.id
LEFT JOIN area a ON s.province_id = a.areaid
LEFT JOIN area b ON s.city_id = b.areaid
LEFT JOIN area c ON s.area_id = c.areaid
WHERE o.id=#{id}
</select>
<select id="fetchProductId" parameterType="java.lang.Long" resultType="com.cftech.order.model.OrderFromVO">
SELECT
<include refid="sqlColumnProduct"/>
from
t_order_details d
LEFT JOIN t_order o ON d.order_id =o.id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
WHERE
d.order_id =#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM (select count(1) from t_order o
LEFT JOIN t_shipping_address s ON o.address_id = s.id
LEFT JOIN t_order_details d ON o.id = d.order_id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
LEFT JOIN area a ON s.province_id = a.areaid
LEFT JOIN area b ON s.city_id = b.areaid
LEFT JOIN area c ON s.area_id = c.areaid
<include refid="sqlWhere"/>
GROUP BY o.id
) b
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMapList">
SELECT
<include refid="sqlColumns"/>
FROM t_order o
LEFT JOIN t_shipping_address s ON o.address_id = s.id
LEFT JOIN t_order_details d ON o.id = d.order_id
LEFT JOIN t_aidea_product t ON d.drugs_id = t.id
LEFT JOIN area a ON s.province_id = a.areaid
LEFT JOIN area b ON s.city_id = b.areaid
LEFT JOIN area c ON s.area_id = c.areaid
LEFT JOIN t_qyuser q ON o.service_id = q.id AND o.doctor_id = q.id
LEFT JOIN `user` u ON u.userid = q.id
<include refid="sqlWhere"/>
<if test="id!=null"> ${id} = b.id </if>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<select id="listProduct" resultType="com.cftech.order.model.ProductOrder">
SELECT id,product_name as productName,price FROM t_aidea_product
</select>
<update id="update" parameterType="com.cftech.order.model.Order">
update t_order
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="consultId != null">
consult_id = #{consultId, jdbcType=BIGINT},
</if>
<if test="number != null">
number = #{number, jdbcType=VARCHAR},
</if>
<if test="memberId != null">
member_id = #{memberId, jdbcType=BIGINT},
</if>
<if test="serviceId != null">
service_id = #{serviceId, jdbcType=BIGINT},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=BIGINT},
</if>
<if test="openid != null">
openid = #{openid, jdbcType=VARCHAR},
</if>
<if test="payStatus != null">
pay_status = #{payStatus, jdbcType=BIGINT},
</if>
<if test="payAmount != null">
pay_amount = #{payAmount, jdbcType=DECIMAL},
</if>
<if test="orderAmount != null">
order_amount = #{orderAmount, jdbcType=DECIMAL},
</if>
<if test="totalAmount != null">
total_amount = #{totalAmount, jdbcType=DECIMAL},
</if>
<if test="payTime != null">
pay_time = #{payTime, jdbcType=TIMESTAMP},
</if>
<if test="tradeNo != null">
trade_no = #{tradeNo, jdbcType=VARCHAR},
</if>
<if test="remarks != null">
remarks = #{remarks, jdbcType=VARCHAR},
</if>
<if test="orderCancel != null">
order_cancel = #{orderCancel, jdbcType=VARCHAR},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_order set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
<select id="fetchProduct" resultType="com.cftech.order.model.ProductDto" parameterType="java.util.Map">
SELECT * FROM t_aidea_product WHERE id = #{productId} AND accounts_id=#{accountsId}
</select>
<update id="updateDetill" parameterType="java.util.Map">
update t_order_details
<set>
<if test="productId != null">
drugs_id = #{productId},
</if>
<if test="drugsNum != null">
drugs_num = #{drugsNum},
</if>
<if test="price != null">
price = #{price},
</if>
<if test="amount != null">
amount = #{amount},
</if>
</set>
where order_id =#{id} and accounts_id=#{accountsId}
</update>
<select id="fetcheDeta" parameterType="java.util.Map" resultType="java.lang.Long">
select * from t_order_details where order_id =#{id} and accounts_id=#{accountsId}
</select>
<select id="saveDetill" parameterType="com.cftech.order.model.OrderDetail">
insert into t_order_details
(
<include refid="Column"/>
)
values
(
now(),
#{orderId},
#{orderCode},
#{drugsId},
#{drugsNum},
#{openid},
#{price},
#{amount},
#{drugsCode},
#{drugsSku},
#{drugsMateriel},
#{accountsId},
0,
now(),
#{createTime},
#{updateTime},
now(),
#{createBy},
#{updateBy}
)
</select>
<select id="fetchOrder" resultType="com.cftech.order.model.Order" parameterType="java.lang.Long">
select * from t_order where id= #{id}
</select>
<update id="updateOrder" parameterType="java.util.Map">
update t_order
<set>
<if test="orderAmount!=null" >
order_amount = #{orderAmount}
</if>
</set>
where id= #{id}
</update>
</mapper>
\ No newline at end of file
package com.cftech.order.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 订单管理
*
* @author Licc
* @date: 2020-10-10 14:20
*/
public class Order extends OrderDetail implements Serializable {
/* 主键id */
private Long id;
/* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode;
/* 咨询单id */
@ExportConfig(value = "咨询单id", width = 100, showLevel = 1)
private Long consultId;
/* 咨询单编码 */
@ExportConfig(value = "咨询单编码", width = 100, showLevel = 1)
private String number;
/* 所属会员id */
@ExportConfig(value = "所属会员id", width = 100, showLevel = 1)
private Long memberId;
/* 客服id */
@ExportConfig(value = "客服id", width = 100, showLevel = 1)
private Long serviceId;
/* 医生id */
@ExportConfig(value = "医生id", width = 100, showLevel = 1)
private Long doctorId;
/* 用户所属公众号id */
@ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1)
private String openid;
/* 付款状态 0未付款 1已付款 */
@ExportConfig(value = "付款状态 0未付款 1已付款", width = 100, showLevel = 1)
private Long payStatus;
/* 付款金额 */
@ExportConfig(value = "付款金额", width = 100, showLevel = 1)
private Double payAmount;
/* 订单金额 */
@ExportConfig(value = "订单金额", width = 100, showLevel = 1)
private Double orderAmount;
/* 商品最终金额 */
@ExportConfig(value = "商品最终金额", width = 100, showLevel = 1)
private Double totalAmount;
/* 付款时间 */
@ExportConfig(value = "付款时间", width = 100, showLevel = 1)
private Date payTime;
/* 交易号 支付宝/第三方平台 返回订单号 */
@ExportConfig(value = "交易号 支付宝/第三方平台 返回订单号", width = 100, showLevel = 1)
private String tradeNo;
/* 卖家备注 */
@ExportConfig(value = "卖家备注", width = 100, showLevel = 1)
private String remarks;
/* 订单取消原因 */
@ExportConfig(value = "订单取消原因", width = 100, showLevel = 1)
private String orderCancel;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
private Long confirm;
private String courierNumber;
/* 产品编码 */
private String productNumber;
/* 产品名称 */
private String productName;
/* 收货地址 */
private String address;
private Long productId;
private List<ProductVO> list;
public Order() {
this.delFlag = false;
this.status = "0";
}
@Override
public Long getId() {
return id;
}
@Override
public void setId(Long id) {
this.id = id;
}
@Override
public String getOrderCode() {
return orderCode;
}
@Override
public void setOrderCode(String orderCode) {
this.orderCode = orderCode;
}
public Long getConsultId() {
return consultId;
}
public void setConsultId(Long consultId) {
this.consultId = consultId;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public Long getMemberId() {
return memberId;
}
public void setMemberId(Long memberId) {
this.memberId = memberId;
}
public Long getServiceId() {
return serviceId;
}
public void setServiceId(Long serviceId) {
this.serviceId = serviceId;
}
public Long getDoctorId() {
return doctorId;
}
public void setDoctorId(Long doctorId) {
this.doctorId = doctorId;
}
@Override
public String getOpenid() {
return openid;
}
@Override
public void setOpenid(String openid) {
this.openid = openid;
}
public Long getPayStatus() {
return payStatus;
}
public void setPayStatus(Long payStatus) {
this.payStatus = payStatus;
}
public Double getPayAmount() {
return payAmount;
}
public void setPayAmount(Double payAmount) {
this.payAmount = payAmount;
}
public Double getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(Double orderAmount) {
this.orderAmount = orderAmount;
}
public Double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
public Date getPayTime() {
return payTime;
}
public void setPayTime(Date payTime) {
this.payTime = payTime;
}
public String getTradeNo() {
return tradeNo;
}
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo;
}
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getOrderCancel() {
return orderCancel;
}
public void setOrderCancel(String orderCancel) {
this.orderCancel = orderCancel;
}
@Override
public Long getAccountsId() {
return accountsId;
}
@Override
public void setAccountsId(Long accountsId) {
this.accountsId = accountsId;
}
@Override
public boolean isDelFlag() {
return delFlag;
}
@Override
public void setDelFlag(boolean delFlag) {
this.delFlag = delFlag;
}
@Override
public String getStatus() {
return status;
}
@Override
public void setStatus(String status) {
this.status = status;
}
@Override
public Date getCreateTime() {
return createTime;
}
@Override
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public Date getUpdateTime() {
return updateTime;
}
@Override
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String getDescription() {
return description;
}
@Override
public void setDescription(String description) {
this.description = description;
}
@Override
public Long getCreateBy() {
return createBy;
}
@Override
public void setCreateBy(Long createBy) {
this.createBy = createBy;
}
@Override
public Long getUpdateBy() {
return updateBy;
}
@Override
public void setUpdateBy(Long updateBy) {
this.updateBy = updateBy;
}
public Long getConfirm() {
return confirm;
}
public void setConfirm(Long confirm) {
this.confirm = confirm;
}
public String getCourierNumber() {
return courierNumber;
}
public void setCourierNumber(String courierNumber) {
this.courierNumber = courierNumber;
}
public String getProductNumber() {
return productNumber;
}
public void setProductNumber(String productNumber) {
this.productNumber = productNumber;
}
public String getProductName() {
if (list==null) {
return null;
}
List<String> collect = this.list.stream().map(x -> x.getProductName()).collect(Collectors.toList());
return StringUtils.join(collect,";");
}
public void setProductName(String productName) {
this.productName = productName;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public List<ProductVO> getList() {
return list;
}
public void setList(List<ProductVO> list) {
this.list = list;
}
}
\ No newline at end of file
package com.cftech.order.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 订单管理
*
* @author Licc
* @date: 2020-10-10 15:37
*/
@Data
public class OrderDetail implements Serializable {
/* 主键id */
private Long id;
/* 订单id */
@ExportConfig(value = "订单id", width = 100, showLevel = 1)
private Long orderId;
/* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode;
/* 商品id */
@ExportConfig(value = "商品id", width = 100, showLevel = 1)
private Long drugsId;
/* 商品数量 */
@ExportConfig(value = "商品数量", width = 100, showLevel = 1)
private Long drugsNum;
/* 用户所属公众号id */
@ExportConfig(value = "用户所属公众号id", width = 100, showLevel = 1)
private String openid;
/* 商品价格 */
@ExportConfig(value = "商品价格", width = 100, showLevel = 1)
private Double price;
/* 商品总价 */
@ExportConfig(value = "商品总价", width = 100, showLevel = 1)
private Double amount;
/* 商品编码 */
@ExportConfig(value = "商品编码", width = 100, showLevel = 1)
private String drugsCode;
/* 商品sku(规格) */
@ExportConfig(value = "商品sku(规格)", width = 100, showLevel = 1)
private String drugsSku;
/* 对应erp物料号 */
@ExportConfig(value = "对应erp物料号", width = 100, showLevel = 1)
private String drugsMateriel;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public OrderDetail() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.order.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.cftech.order.utils.JSONSeriableUtils;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.omg.CORBA.PRIVATE_MEMBER;
import java.util.Date;
/**
* @author :licc
* @date :Created in 2020/10/13 12:10
* @description:
*/
@Data
public class OrderFromVO {
private Long id;
private String orderCode;
private String courierNumber;
private String productNumber;
private Long productId;
private Long drugsNum;
private double orderAmount;
private String address;
private Long payStatus;
private String description;
private String tradeNo;
@JSONField(format="yyyy-MM-dd HH:mm:ss")
private Date createTime;
private Long confirm;
private String orderCancel;
private Double price;
private Double amount;
}
package com.cftech.order.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.util.Date;
/**
* @author :licc
* @date :Created in 2020/10/12 9:48
* @description:
*/
@Data
public class OrderVO {
/* 订单编码 */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderCode;
/* 产品编码 */
@ExportConfig(value = "商品编码",width = 100,showLevel = 1)
private String productNumber;
/* 产品名称 */
@ExportConfig(value = "商品名称",width = 100,showLevel = 1)
private String productName;
/* 订单金额 */
@ExportConfig(value = "订单金额", width = 100, showLevel = 1)
private Double orderAmount;
/* 收货地址 */
@ExportConfig(value = "收货地址",width = 100,showLevel = 1)
private String address;
@ExportConfig(value = "快递单号",width = 100,showLevel = 1)
private String courierNumber;
/* 交易号 支付宝/第三方平台 返回订单号 */
@ExportConfig(value = "支付交易号", width = 100, showLevel = 1)
private String tradeNo;
/* 创建时间 */
@ExportConfig(value = "创建时间",width = 100,showLevel = 1)
private String createTime;
/* 订单状态 */
@ExportConfig(value = "订单状态",width = 100,showLevel = 1)
private String payStatus;
}
package com.cftech.order.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 产品
*
* @author Buyj
* @date: 2020-09-24 15:07
*/
@Data
public class ProductDto implements Serializable {
/**
* 主键id
*/
private Long id;
/**
* 产品分类ID
*/
private String classifyId;
/**
* 产品分类编码
*/
@ExportConfig(value = "产品分类编码",width = 150 ,showLevel = 2)
private String classifyNumber;
/**
* 产品分类名称
*/
@ExportConfig(value = "产品分类名称", width = 150, showLevel = 1)
private String classifyName;
/**
* 产品编码
*/
@ExportConfig(value = "产品编码", width = 100)
private String productNumber;
/**
* 产品名称
*/
@ExportConfig(value = "产品名称", width = 100)
private String productName;
/**
* 通用名
*/
@ExportConfig(value = "通用名", width = 100)
private String commonName;
/**
*剂型
*/
@ExportConfig(value = "剂型", width = 100)
private String dosagaFrom;
/**
*规格
*/
@ExportConfig(value = "规格", width = 100)
private String format;
/**
*批准文号
*/
@ExportConfig(value = "批准文号",width = 100)
private String approveNumber;
/**
*生产企业
*/
@ExportConfig(value = "生产企业", width = 100)
private String manufacturer;
/**
*推荐计量
*/
@ExportConfig(value = "推荐计量", width = 100)
private String recommendMeasure;
/**
* 药品简介
*/
@ExportConfig(value = "药品简介",width = 150)
private String description;
/**
*温馨提示
*/
@ExportConfig(value = "温馨提示", width = 100)
private String tips;
/**
* 服用类型
*/
@ExportConfig(value = "服用类型(天/周/月)", width = 200)
private String takeType;
/**
*服用频率
*/
@ExportConfig(value = "服用频率", width = 100)
private String takeFrequency;
/**
*服用次数
*/
@ExportConfig(value = "服用数量", width = 100)
private String takeAmount;
/**
*库存
*/
@ExportConfig(value = "库存", width = 100)
private Long stock;
/**
*价格
*/
@ExportConfig(value = "价格", width = 100)
private Double price;
/**
* 是否为处方药
*/
@ExportConfig(value = "是否为处方药(是/否)",width = 200)
private String isRs;
/**
* 产品详情图
*/
private String productImgDetail;
/**
*产品图片
*/
private String productImg;
/**
* 入库编码
*/
private String ruKuNumber;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
public ProductDto() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.order.model;
import lombok.Data;
/**
* @author :licc
* @date :Created in 2020/10/13 11:18
* @description:
*/
@Data
public class ProductOrder {
private Long id;
private String productName;
private Double price;
}
package com.cftech.order.model;
import lombok.Data;
/**
* @author :licc
* @date :Created in 2020/10/12 22:51
* @description:
*/
@Data
public class ProductVO {
private String productName;
}
package com.cftech.order.service;
import com.alibaba.fastjson.JSONObject;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.order.model.Order;
import com.cftech.core.generic.GenericService;
import com.cftech.order.model.OrderFromVO;
import com.cftech.order.model.ProductOrder;
import java.io.Serializable;
import java.util.List;
/**
* 订单管理Service
*
* @author Licc
* @date: 2020-10-10 14:20
*/
public interface OrderService extends GenericService<Order> {
List<Order> fetchSearchBy(Conds conds, Sort sort, int page, int pageSize , Long id);
List<ProductOrder> listProduct();
OrderFromVO fetchId(Serializable id);
List<OrderFromVO> fetchProductId(Serializable id);
Long newlyAdded(String datas,Long accountsId);
}
package com.cftech.order.service.impl;
import com.cftech.core.sql.Sort;
import com.cftech.order.model.*;
import com.cftech.order.dao.OrderMapper;
import com.cftech.order.service.OrderService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 订单管理ServiceImpl
*
* @author Licc
* @date: 2020-10-10 14:20
*/
@Service("orderService")
public class OrderServiceImpl extends GenericServiceImpl<Order> implements OrderService {
@Autowired
@Qualifier("orderMapper")
private OrderMapper orderMapper;
@Override
public GenericDao<Order> getGenericMapper() {
return orderMapper;
}
@Override
public List<Order> fetchSearchBy(Conds conds, Sort sort, int page, int pageSize, Long id) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("conds", conds);
params.put("offset", page > 0 ? page : 0);
params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort);
params.put("id", id);
return orderMapper.fetchSearchByPage(params);
}
@Override
public List<ProductOrder> listProduct() {
return orderMapper.listProduct();
}
@Override
public OrderFromVO fetchId(Serializable id) {
return orderMapper.fetchId(id);
}
@Override
public List<OrderFromVO> fetchProductId(Serializable id) {
return orderMapper.fetchProductId(id);
}
@Transactional
@Override
public Long newlyAdded(String datas, Long accountsId) {
OrderDetail orderDetail = null;
Map<String, Object> params = null;
datas = datas.replaceAll("&quot;","\"");
JSONArray jsonArray = JSONArray.fromObject(datas);
if (jsonArray.size()>0){
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject jsonObject = jsonArray.getJSONObject(i);
long id = jsonObject.getLong("id");
long productId = jsonObject.getLong("productId");
long drugsNum = jsonObject.getLong("drugsNum");
double price = jsonObject.getDouble("price");
double amount = jsonObject.getDouble("amount");
double orderAmount = jsonObject.getDouble("orderAmount");
params = new HashMap<String, Object>();
params.put("id",id);
params.put("accountsId",accountsId);
Long aLong = orderMapper.fetcheDeta(params);
if (aLong>0){
params.put("productId",productId);
params.put("drugsNum",drugsNum);
params.put("price",price);
params.put("amount",amount);
Long detill = orderMapper.updateDetill(params);
if (detill>0){
return detill;
}
}else{
ProductDto productDtos = orderMapper.fetchProduct(params);
orderDetail = new OrderDetail();
Order orders = orderMapper.fetchOrder(id);
orderDetail.setOrderId(id);
orderDetail.setOrderCode(orders.getOrderCode());
orderDetail.setDrugsId(productDtos.getId());
orderDetail.setDrugsNum(drugsNum);
orderDetail.setOpenid(orders.getOpenid());
orderDetail.setPrice(productDtos.getPrice());
orderDetail.setAmount(amount);
orderDetail.setDrugsCode(productDtos.getProductNumber());
orderDetail.setDrugsSku(productDtos.getFormat());
orderDetail.setAccountsId(accountsId);
Long detill = orderMapper.saveDetill(orderDetail);
if (detill>0){
orderMapper.updateOrder(params);
return detill;
}
}
}
}
// Long detill = orderMapper.updateDetill(id, productId, drugsNum, price, amount, accountsId);
// List<ProductDto> productDtos = orderMapper.fetchProduct(productId, accountsId);
// List<Order> orders = orderMapper.fetchOrder(id);
// orderDetail.setOrderId(id);
return null;
}
}
\ No newline at end of file
package com.cftech.order.utils;
import com.alibaba.fastjson.serializer.ValueFilter;
import java.math.BigDecimal;
public class DoubleJSONFilter implements ValueFilter {
@Override
public Object process(Object value, String s, Object o1) {
if( o1 instanceof Double ){
BigDecimal bg = new BigDecimal((Double) o1);
Double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
return 60.00;
}
return o1;
}
}
package com.cftech.order.utils;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.apache.commons.lang3.math.NumberUtils;
import java.io.IOException;
import java.math.RoundingMode;
import java.text.DecimalFormat;
/**
* @author :licc
* @date :Created in 2020/10/16 17:37
* @description:J
*/
public class JSONSeriableUtils extends JsonSerializer<Double> {
@Override
public void serialize(Double aDouble, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException {
if(aDouble !=null) {
DecimalFormat df = new DecimalFormat("0.00");
df.setRoundingMode(RoundingMode.HALF_UP);
jsonGenerator.writeString(df.format(aDouble));
}else {//这个分支不要忘记了,否则将不输出这个属性的值
jsonGenerator.writeString(aDouble.toString());
}
}
}
package com.cftech.order.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONAware;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.cftech.order.model.Order;
import com.cftech.order.model.OrderFromVO;
import com.cftech.order.model.OrderVO;
import com.cftech.order.model.ProductOrder;
import com.cftech.order.service.OrderService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.order.utils.DoubleJSONFilter;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.LinkedList;
import java.util.List;
/**
* 订单管理Controller
* <p>
* 权限字符串说明:
* 查看:public static final String ORDER_VIEW = "qy:order:view"
* 查看:public static final String ORDER_EDIT = "qy:order:edit"
*
* @author Licc
* @date: 2020-10-10 14:20
*/
@Slf4j
@Controller
@RequestMapping("/a/order")
public class OrderController {
public static final String ORDER_VIEW = "qy:order:view";
public static final String ORDER_EDIT = "qy:order:edit";
public static final DoubleJSONFilter DOUBLE_JSON_FILTER = new DoubleJSONFilter();
@Autowired
private OrderService orderService;
//列表页面
@RequiresPermissions(value = ORDER_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "order/orderlist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = ORDER_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
OrderFromVO orderFromVO = orderService.fetchId(id);
List<OrderFromVO> fromVO = orderService.fetchProductId(id);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(orderFromVO));
String jsonArray = JSON.toJSONString(fromVO, DOUBLE_JSON_FILTER ,SerializerFeature.WriteMapNullValue);
model.addAttribute("data", jsonObject);
model.addAttribute("list", jsonArray);
}
return "order/orderform";
}
@RequestMapping("/fromProduct")
@ResponseBody
public List<ProductOrder> fromProduct(){
return orderService.listProduct();
}
//提交数据(新增、修改)
@RequiresPermissions(value = ORDER_EDIT)
@PostMapping("/formData")
@ResponseBody
public JSONObject formData(HttpServletRequest request,String datas) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
Long aLong = orderService.newlyAdded(datas,accountsId);
if (aLong>0 && aLong!=null){
rtnJson.put("aaData", 1);
}
rtnJson.put("aaData", 0);
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = ORDER_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, Order order, HttpServletRequest request) {
Long id = UserUtils.getUser().getUserid();
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("o.del_flag", Constants.DEL_FLAG_0);
conds.equal("o.accounts_id", accountsId);
Sort sort = new Sort("o.create_time", OrderType.DESC);
if(!StringUtils.isEmpty(order.getOrderCode())){
conds.like("o.order_code",order.getOrderCode()) ;
}
if (!StringUtils.isEmpty(order.getProductName())){
conds.like("t.product_name",order.getProductName());
}
List<Order> list = orderService.fetchSearchBy(conds, sort, iDisplayStart, iDisplayLength,id);
Integer counts = orderService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = ORDER_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
orderService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = ORDER_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("o.create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("o.del_flag", 0);
conds.equal("o.accounts_id", accountId);
List<Order> list = orderService.fetchSearchByPage(conds, sort, 0, 0);
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
LinkedList<OrderVO> orderVOS = new LinkedList<>();
for(Order order :list){
OrderVO orderVO = new OrderVO();
orderVO.setOrderCode(order.getOrderCode());
orderVO.setProductNumber(order.getProductNumber());
orderVO.setProductName(order.getProductName());
orderVO.setOrderAmount(order.getOrderAmount());
orderVO.setAddress(order.getAddress());
orderVO.setCourierNumber(order.getCourierNumber());
orderVO.setTradeNo(order.getTradeNo());
orderVO.setCreateTime(simpleDateFormat.format(order.getCreateTime()));
orderVO.setPayStatus(order.getPayStatus().equals("0") ? "未付款" : order.getPayStatus().equals("1") ? "已付款" : "已取消");
orderVOS.add(orderVO);
}
ExcelKit.$Export(OrderVO.class, response).toExcel(orderVOS, "订单管理信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = ORDER_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(Order.class, response).toExcel(null, "订单管理信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = ORDER_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
Order order = new Order();
order.setAccountsId(accountId);
orderService.save(order);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
CREATE TABLE `t_order` (`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键id',`consult_id` bigint(20) NULL DEFAULT NULL COMMENT '咨询单id',`number` varchar(50) NULL DEFAULT NULL COMMENT '咨询单编码',`member_id` bigint(20) NULL DEFAULT NULL COMMENT '所属会员id',`service_id` bigint(20) NULL DEFAULT NULL COMMENT '客服id',`doctor_id` bigint(20) NULL DEFAULT NULL COMMENT '医生id',`openid` varchar(100) NULL DEFAULT NULL COMMENT '用户所属公众号id',`pay_status` bigint(20) NULL DEFAULT NULL COMMENT '付款状态 0未付款 1已付款',`pay_amount` varchar(20) NULL DEFAULT NULL COMMENT '付款金额',`order_amount` varchar(20) NULL DEFAULT NULL COMMENT '订单金额',`total_amount` varchar(20) NULL DEFAULT NULL COMMENT '商品最终金额',`pay_time` varchar(20) NULL DEFAULT NULL COMMENT '付款时间',`trade_no` varchar(50) NULL DEFAULT NULL COMMENT '交易号 支付宝/第三方平台 返回订单号',`remarks` varchar(100) NULL DEFAULT NULL COMMENT '卖家备注',`order_cancel` varchar(100) NULL DEFAULT NULL COMMENT '订单取消原因',`accounts_id` bigint(20) NULL DEFAULT NULL COMMENT '所属的账号',`del_flag` tinyint(4) NOT NULL DEFAULT 0 COMMENT '删除标识',`status` varchar(10) NULL DEFAULT '0' COMMENT '状态',`create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',`update_time` datetime NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',`description` varchar(100) NULL DEFAULT NULL COMMENT '备注',`create_by` bigint(20) NULL DEFAULT NULL COMMENT '创建人',`update_by` bigint(20) NULL DEFAULT NULL COMMENT '更新人',PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='订单管理表';
\ No newline at end of file
...@@ -22,6 +22,12 @@ ...@@ -22,6 +22,12 @@
<module>product-into-wareroom-module-web</module> <module>product-into-wareroom-module-web</module>
<module>product-module</module> <module>product-module</module>
<module>product-module-web</module> <module>product-module-web</module>
<module>order-module</module>
<module>order-module-web</module>
<module>order-detail-module</module>
<module>order-detail-module-web</module>
<module>reportform-module</module>
<module>reportform-module-web</module>
</modules> </modules>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cftech</groupId>
<artifactId>reportform-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>reportform-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>reportform-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>reportform-module-web</finalName>
</build>
</project>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
报表管理管理
<small>报表管理</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">报表管理</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:reportForm:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/reportForm/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/reportForm/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/reportForm/form')";
},
cancel: function () {
location.href = "#springUrl('/a/reportForm/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/reportForm/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/reportForm/list')";
}
});
}
});
}
})
}
initFormCtrl();
}
return {
//main function to initiate the module
init: function () {
initForm();
}
};
}();
</script>
</body>
<!-- END BODY -->
</html>
\ No newline at end of file
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Morris chart -->
<link rel="stylesheet" href="plugins/morris/morris.css">
<!-- jvectormap -->
<link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap-1.2.2.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<link rel="stylesheet"
href="plugins\bootstrap-fileinput\fileinput.min.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<div id="importExcelDiv"></div>
<section class="content-header">
<h1>
报表管理管理
<small>报表管理</small>
</h1>
<ol class="breadcrumb">
<li><a><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">报表管理管理列表</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/reportForm/list')" method="get">
<div class="col-xs-5">
<div class="col-xs-2" >
<input type="text" class="form-control required"
id="pharmacist" name="pharmacist" placeholder="药师名称">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control required"
id="customerName" name="customerName" placeholder="客服名称">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control required"
id="orderCode" name="orderCode" placeholder="订单号">
</div>
<div class="col-xs-2" >
<input type="text" class="form-control required"
id="logisticsCode" name="logisticsCode" placeholder="物流单号">
</div>
<button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:reportForm:edit"))
<a href="#springUrl('/a/reportForm/exportExcel')" class="btn btn-primary">导出</a>
#end
<!-- -->
<!-- <a href="#springUrl('/a/reportForm/form')" class="btn btn-primary">新增</a>-->
<!-- -->
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
<!-- -->
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<th>药师名称</th>
<th>客服名称</th>
<th>订单编号</th>
<th>订单金额</th>
<th>咨询单号</th>
<th>物流单号</th>
<th>物流状态</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
function formatDates(now) {
var now = new Date(now);
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
return year + "-" + month + "-" + date + " " + hour + ":"
+ minute + ":" + second;
}
function seachTable() {
var sSource = "#springUrl('/a/reportForm/listData')";
var aoData = {
iDisplayStart: 1,
iDosplayLength: 10
}
var retrieveData = function (sSource, aoData, fnCallback) {
$("#seachTableForm input").each(function () {
var params = {
name: $(this).attr("name"),
value: $(this).val()
};
aoData.push(params);
})
$.ajax({
"type": "GET",
"url": sSource,
"dataType": "json",
"data": aoData, //以json格式传递
"success": fnCallback
});
};
$('#table').DataTable({
"lengthChange": false,
"searching": false,
"ordering": false,
"bFiltered": false,
"bStateSave": true, // save datatable state(pagination, sort, etc) in cookie.
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": sSource,
"fnServerData": retrieveData,
"pagingType": "full_numbers",
"aoColumns": [
{
"mData": "pharmacist"
},
{
"mData": "customerName"
},
{
"mData": "orderCode"
}
,
{
"mData": "orderAmount"
}
,
{
"mData": "numberCode"
}
,
{
"mData": "logisticsCode"
}
,
{
"mData": "logisticsStatus"
}
],
"aoColumnDefs": [
{
"aTargets": [0],
"mData": "pharmacist",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [1],
"mData": "customerName",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [2],
"mData": "orderCode",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [3],
"mData": "orderAmount",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [4],
"mData": "numberCode",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [5],
"mData": "logisticsCode",
"mRender": function (a, b, c, d) {
return a;
}
},{
"aTargets": [6],
"mData": "logisticsStatus",
"mRender": function (a, b, c, d) {
return a;
}
}
]
});
}
jQuery(document).ready(function () {
seachTable();
$('.datepicker').datepicker({
show: true,
format: 'yyyy-mm-dd',
autoclose: true,
language: 'zh-CN',
todayBtn: 'linked',
clearBtn: 'linked'
});
$('.search').click(function () {
$("#table").dataTable().fnClearTable();
});
});
Cfapp.init();
function removeData(data) {
Cfapp.confirm({
message: "确定要删除吗",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
$.ajax({
type: "POST",
url: "#springUrl('/a/reportForm/delete')",
data: {id: data},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/reportForm/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function importExcel() {
var templateExcelUrl = "#springUrl('/a/reportForm/templateExcel')";
var importExcelUrl = "#springUrl('/a/reportForm/importExcel')";
Cfapp.importExcel({
title: '报表管理导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function () {
}
});
}
</script>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.cftech</groupId>
<artifactId>reportform-module</artifactId>
<version>1.0-SNAPSHOT</version>
</project>
package com.cftech.reportform.dao;
import com.cftech.reportform.model.ReportForm;
import com.cftech.core.generic.GenericDao;
/**
* 报表管理Mapper
*
* @author Licc
* @date: 2020-10-16 14:33
*/
public interface ReportFormMapper extends GenericDao<ReportForm> {
}
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cftech.reportform.dao.ReportFormMapper">
<resultMap id="resultMap" type="com.cftech.reportform.model.ReportForm">
<id column="id" property="id"/>
<result column="accounts_id" property="accountsId"/>
<result column="del_flag" property="delFlag"/>
<result column="status" property="status"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="description" property="description"/>
<result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/>
</resultMap>
<sql id="sqlWhere">
<if test="conds!=null">
<trim prefix="WHERE" prefixOverrides="AND|OR">
<foreach collection="conds.conds" index="index" item="cond">
${cond.linkType}
<if test="cond.condType == 'EQUAL'">${cond.param} = #{cond.value}</if>
<if test="cond.condType == 'NOTEQUAL'">${cond.param} &lt;&gt; #{cond.value}</if>
<if test="cond.condType == 'GREATEQUAL'">${cond.param} &gt;= #{cond.value}</if>
<if test="cond.condType == 'GREATTHAN'">${cond.param} &gt; #{cond.value}</if>
<if test="cond.condType == 'LESSEQUAL'">${cond.param} &lt;= #{cond.value}</if>
<if test="cond.condType == 'LESSTHAN'">${cond.param} &lt; #{cond.value}</if>
<if test="cond.condType == 'BETWEEN'">${cond.param} BETWEEN #{cond.startValue} AND
#{cond.endValue}
</if>
<if test="cond.condType == 'ISNULL'">${cond.param} IS NULL</if>
<if test="cond.condType == 'NOTNULL'">${cond.param} IS NOT NULL</if>
<if test="cond.condType == 'LIKE'">${cond.param} LIKE #{cond.value}</if>
<if test="cond.condType == 'IN'">${cond.param} IN
<foreach item="item" index="index" collection="cond.value" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</foreach>
</trim>
</if>
</sql>
<sql id="sqlColumns">
q.`name`
AS pharmacist,
t.`name` AS customerName,
o.order_code AS orderCode,
o.order_amount AS order_amount,
o.number AS numberCode
</sql>
<insert id="save" parameterType="com.cftech.reportform.model.ReportForm" useGeneratedKeys="true"
keyProperty="id">
insert into t_order
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_order t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_order o
LEFT JOIN t_qyuser t ON t.id = o.service_id
LEFT JOIN t_qyuser q ON q.id = o.doctor_id
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_order o
LEFT JOIN t_qyuser t ON t.id = o.service_id
LEFT JOIN t_qyuser q ON q.id = o.doctor_id
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<update id="update" parameterType="com.cftech.reportform.model.ReportForm">
update t_order
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="accountsId != null">
accounts_id = #{accountsId, jdbcType=BIGINT},
</if>
<if test="delFlag != null">
del_flag = #{delFlag, jdbcType=TINYINT},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime, jdbcType=TIMESTAMP},
</if>
<if test="description != null">
description = #{description, jdbcType=VARCHAR},
</if>
<if test="createBy != null">
create_by = #{createBy, jdbcType=BIGINT},
</if>
<if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_order set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.reportform.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 报表管理
*
* @author Licc
* @date: 2020-10-16 14:33
*/
@Data
public class ReportForm implements Serializable {
/*药师名称*/
@ExportConfig(value = "药师名称", width = 100, showLevel = 1)
private String pharmacist;
/*客服名称*/
@ExportConfig(value = "客服名称", width = 100, showLevel = 1)
private String customerName;
/*订单编号*/
@ExportConfig(value = "订单编号", width = 100, showLevel = 1)
private String orderCode;
/*订单金额*/
@ExportConfig(value = "订单金额", width = 100, showLevel = 1)
private Double orderAmount;
/*咨询单号*/
@ExportConfig(value = "咨询单号", width = 100, showLevel = 1)
private String numberCode;
/*物流单号 */
@ExportConfig(value = "物流单号", width = 100, showLevel = 1)
private String logisticsCode;
/*物流状态*/
@ExportConfig(value = "物流状态", width = 100, showLevel = 1)
private Long logisticsStatus;
/* 所属的账号 */
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
private Date updateTime;
/* 备注 */
private String description;
/* 创建人 */
private Long createBy;
/* 更新人 */
private Long updateBy;
}
\ No newline at end of file
package com.cftech.reportform.service;
import com.cftech.reportform.model.ReportForm;
import com.cftech.core.generic.GenericService;
/**
* 报表管理Service
*
* @author Licc
* @date: 2020-10-16 14:33
*/
public interface ReportFormService extends GenericService<ReportForm> {
}
package com.cftech.reportform.service.impl;
import com.cftech.reportform.model.ReportForm;
import com.cftech.reportform.dao.ReportFormMapper;
import com.cftech.reportform.service.ReportFormService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 报表管理ServiceImpl
*
* @author Licc
* @date: 2020-10-16 14:33
*/
@Service("reportFormService")
public class ReportFormServiceImpl extends GenericServiceImpl<ReportForm> implements ReportFormService {
@Autowired
@Qualifier("reportFormMapper")
private ReportFormMapper reportFormMapper;
@Override
public GenericDao<ReportForm> getGenericMapper() {
return reportFormMapper;
}
}
\ No newline at end of file
package com.cftech.reportform.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.reportform.model.ReportForm;
import com.cftech.reportform.service.ReportFormService;
import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.sys.security.PermissionSign;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
/**
* 报表管理Controller
* <p>
* 权限字符串说明:
* 查看:public static final String REPORTFORM_VIEW = "qy:reportForm:view"
* 查看:public static final String REPORTFORM_EDIT = "qy:reportForm:edit"
*
* @author Licc
* @date: 2020-10-16 14:33
*/
@Slf4j
@Controller
@RequestMapping("/a/reportForm")
public class ReportFormController {
public static final String REPORTFORM_VIEW = "qy:reportForm:view";
public static final String REPORTFORM_EDIT = "qy:reportForm:edit";
@Autowired
private ReportFormService reportFormService;
//列表页面
@RequiresPermissions(value = REPORTFORM_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "reportForm/reportFormlist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = REPORTFORM_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
ReportForm reportForm = reportFormService.fetchById(id);
model.addAttribute("data", reportForm);
}
return "reportForm/reportFormform";
}
// //提交数据(新增、修改)
// @RequiresPermissions(value = REPORTFORM_EDIT)
// @RequestMapping("/formData")
// @ResponseBody
// public JSONObject formData(ReportForm reportForm, Model model, HttpServletRequest request) {
// Long accountsId = UserUtils.getmpaccounts(request);
// JSONObject rtnJson = new JSONObject();
// try {
// if (reportForm != null && reportForm.getId() != null) {
// reportForm.setUpdateBy(UserUtils.getUser().getId());
// reportFormService.update(reportForm);
// rtnJson.put("errorNo", 0);
// } else {
// reportForm.setAccountsId(accountsId);
// reportForm.setDelFlag(false);
// reportForm.setAccountsId(UserUtils.getmpaccounts(request));
// reportForm.setCreateBy(UserUtils.getUser().getId());
// reportForm.setUpdateBy(UserUtils.getUser().getId());
// reportFormService.save(reportForm);
// rtnJson.put("errorNo", 2);
// }
// } catch (Exception e) {
// rtnJson.put("errorNo", 1);
// }
// return rtnJson;
// }
//获取列表数据
@RequiresPermissions(value = REPORTFORM_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ReportForm reportForm, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("o.del_flag", Constants.DEL_FLAG_0);
conds.equal("o.accounts_id", accountsId);
conds.like("t.`name`",reportForm.getCustomerName());
conds.like("q.`name`",reportForm.getPharmacist());
conds.like("o.order_code",reportForm.getOrderCode());
Sort sort = new Sort("o.create_time", OrderType.DESC);
List<ReportForm> list = reportFormService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = reportFormService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = REPORTFORM_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
reportFormService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = REPORTFORM_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("o.del_flag", 0);
conds.equal("o.accounts_id", accountId);
List<ReportForm> list = reportFormService.fetchSearchByPage(conds, null, 0, 0);
ExcelKit.$Export(ReportForm.class, response).toExcel(list, "报表管理信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = REPORTFORM_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(ReportForm.class, response).toExcel(null, "报表管理信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = REPORTFORM_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
ReportForm reportForm = new ReportForm();
reportForm.setAccountsId(accountId);
reportFormService.save(reportForm);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
...@@ -79,6 +79,7 @@ ...@@ -79,6 +79,7 @@
<module>workshop-module-web</module> <module>workshop-module-web</module>
<module>schaeffler-modules</module> <module>schaeffler-modules</module>
<module>aidea-modules</module> <module>aidea-modules</module>
<module>reportForm-module</module>
</modules> </modules>
<properties> <properties>
......
...@@ -274,12 +274,24 @@ ...@@ -274,12 +274,24 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
<!--<dependency> <dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>order-module-web</artifactId> <artifactId>order-module-web</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency>--> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>order-detail-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>reportform-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>portal-web</finalName> <finalName>portal-web</finalName>
......
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cftech</groupId>
<artifactId>reportForm-module</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>reportForm-module Maven Webapp</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>reportForm-module</finalName>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
</web-app>
<html>
<body>
<h2>Hello World!</h2>
</body>
</html>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment