Commit 85cba2f2 authored by 黎聪聪's avatar 黎聪聪

咨询单管理

parent ac37690f
...@@ -53,7 +53,23 @@ ...@@ -53,7 +53,23 @@
<div class="wrapper"> <div class="wrapper">
<div class="content-wrapper" style="margin-left:0;"> <div class="content-wrapper" style="margin-left:0;">
<div id="dialog" style="display: none;width: 600px;height: 400px;border: solid white 1px;background: #ffffff;position: fixed;z-index: 2;left:25%;bottom:30%">
<div style="width: 600px;height: 50px;background: ghostwhite;">
<span style="line-height: 50px;padding-left: 30px;font-weight: bold">审核未通过原因</span>
</div>
<div style="padding-left: 120px;padding-top: 50px">
<textarea rows="10" cols="50" id="descriptionAdd">
</textarea>
</div>
<div style="padding-top: 15px;width: 100%;border-bottom: black solid 1px" ></div>
<div style="padding-left: 100px;padding-top: 20px">
<input type="button" style="width: 200.4px" class="btn btn-primary" id="confo" onclick="review() " value="确认" >&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;
<input style="width: 200.4px" type="button" id="close" class="btn btn-primary" id="close" value="关闭" onclick="closeHide()">
</div>
</div>
<section class="content-header"> <section class="content-header">
<h1> <h1>
咨询单管理 咨询单管理
...@@ -73,15 +89,128 @@ ...@@ -73,15 +89,128 @@
<!-- general form elements disabled --> <!-- general form elements disabled -->
<div class="box box-primary"> <div class="box box-primary">
<form role="form" id="myForm"> <form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/> <input id="id" name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body"> <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="consultId"
id="consultId" readonly="readonly"
maxlength="50" placeholder="用药人姓名"
value="$!{data.consultId}"
>
<!-- <div-->
<!-- class="form-control" name="consultId"-->
<!-- id="consultId"-->
<!-- style="height: 68px;background: #EEEEEE"-->
<!-- >$!{data.consultId}</div>-->
<label>用药人姓名<font style="color: red"></font></label>
<input type="text"
class="form-control" name="userName"
id="userName" readonly="readonly"
maxlength="50" placeholder="用药人姓名"
value="$!{data.userName}"
>
<!-- <label>身份证号<font style="color: red"></font></label>-->
<!-- <input type="text"-->
<!-- class="form-control" name="numberId"-->
<!-- id="numberId" readonly="readonly"-->
<!-- maxlength="50" placeholder="身份证号"-->
<!-- value="$!{data.numberId}"-->
<!-- >-->
<label>出生年月<font style="color: red"></font></label>
<input type="text"
class="form-control" name="benebitId"
id="benebitId" readonly="readonly"
maxlength="50" placeholder="出生年月"
value="$!{data.benebitId}"
>
<label>性别<font style="color: red"></font></label>
<input type="text"
class="form-control" name="sex"
id="sex" readonly="readonly"
maxlength="50" placeholder="出生年月"
value="$!{data.sex}"
>
<label>联系方式<font style="color: red"></font></label>
<input type="text"
class="form-control" name="iPhone"
id="iPhone" readonly="readonly"
maxlength="50" placeholder="联系方式"
value="$!{data.iPhone}"
>
<label>疾病史<font style="color: red"></font></label>
<div
class="form-control" name="pastRecords"
id="pastRecords"
maxlength="50"
style="height: 68px;background: #EEEEEE"
>$!{data.pastRecords}</div>
<label>过敏史<font style="color: red"></font></label>
<div
class="form-control" name="allergy"
id="allergy"
maxlength="50"
style="height: 68px;background: #EEEEEE"
>$!{data.allergy}</div>
<label>处方单<font style="color: red"></font></label>
<br/>
<div class="form-group " id="imageurl" style=" width: 130px; height: 120px;margin-left: 5px; padding :10px ;background-color :#f4f4f4; border: 1px solid #CCCCCC">
<img style="cursor:zoom-in; width: 108px;height: 100% " src="$!{data.prescription}" onclick="imgcli(this)">
</div>
<label>药师姓名<font style="color: red"></font></label>
<input type="text"
class="form-control" name="doctorName"
id="doctorName" readonly="readonly"
maxlength="50" placeholder="药师姓名"
value="$!{data.doctorName}"
>
<label>客服姓名<font style="color: red"></font></label>
<input type="text"
class="form-control" name="customerName"
id="customerName" readonly="readonly"
maxlength="50" placeholder="客服姓名"
value="$!{data.customerName}"
>
<label>病情描述<font style="color: red"></font></label>
<div
class="form-control" name="illness"
id="illness"
maxlength="50"
style="height: 68px;background: #EEEEEE"
>$!{data.illness}</div>
<label>审核状态<font style="color: red"></font></label>
<input type="text"
class="form-control" name="status"
id="status" readonly="readonly"
maxlength="50" placeholder="status"
value="$!{data.status}"
>
<label>备注(审核未通过原因)<font style="color: red"></font></label>
<div
class="form-control" name="description"
id="description"
maxlength="50"
style="height: 68px;background: #EEEEEE"
>$!{data.description}</div>
</div> </div>
<div class="box-footer"> <div class="box-footer">
#if($shiro.hasPermission("qy:consultSheet:edit")) #if($shiro.hasPermission("qy:consultSheet:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit"> <input class="btn btn-primary" id="save" value="审核" type="submit">
#end #end
<a href="#springUrl('/a/consultSheet/list')" class="btn btn-default">取消</a> <a style="background: #3C8DBC" id="reject" class="btn btn-default"
onclick="beizhu()">拒绝</a>
<a style="background: #3C8DBC" href="#springUrl('/a/consultSheet/list')" class="btn btn-default">返回</a>
</div>
</div> </div>
</form> </form>
<!-- /.box-body --> <!-- /.box-body -->
...@@ -98,7 +227,9 @@ ...@@ -98,7 +227,9 @@
immediately after the control sidebar --> immediately after the control sidebar -->
<div class="control-sidebar-bg"></div> <div class="control-sidebar-bg"></div>
</div><!-- ./wrapper --> </div><!-- ./wrapper -->
<div id="divimg" style="cursor:zoom-out;background: rgba(0,0,0,.6);width:100%;height:100%;position: absolute;z-index: 9999;left: 0;top: 0;display: none" onclick="hide()">
<img style="width: 50%;margin-left: 30%; ">
</div>
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script> <script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 --> <!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script>
...@@ -124,12 +255,85 @@ ...@@ -124,12 +255,85 @@
<script src="common/js/cfapp.js"></script> <script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS --> <!-- END PAGE LEVEL PLUGINS -->
<script> <script>
var consultid
function beizhu() {
$("#dialog").show();
}
function closeHide(){
$("#dialog").hide();
}
// href="#springUrl('/a/consultSheet/list')"
$().ready(function () { $().ready(function () {
consultid = $("#consultId").val();
var value = $("#sex").val();
// if (value == 0) {
// $("#sex").val("女");
// } else {
// $("#sex").val("男");
// }
var status = $("#status").val();
console.log("status:", status)
if (status == 0) {
$("#status").val("未审核");
} else if (status == 1) {
$("#status").val("已通过");
} else if (status == 2) {
$("#status").val("已拒绝");
}
if (status == 1 || status == 2) {
$("#reject").hide();
$("#save").hide();
}
Cfapp.init(); Cfapp.init();
recdTypeAdd.init(); recdTypeAdd.init();
}); });
$('#divimg').click(function(){$(this).fadeOut(200)})
function imgcli(obj) {
console.log($(obj).attr("src"))
$('#divimg').fadeIn(200);
$('#divimg img').attr('src', $(obj).attr("src"));
$('#divimg img').css("margin-top", "10%")
$('#divimg img').css("height", "55%")
}
function hide() {
$("#hide").hide();
}
function review() {
var url = "#springUrl('/a/consultSheet/updateData')";
var descriptionAdd = $("#descriptionAdd").val();
var aadata ={
consultId : consultid,
status : "2",
description:descriptionAdd
};
$.ajax({
url:url,
data:aadata,
type:"GET",
dataType:"JSON",
success:function(data){
if(data.errorNo==1){
alert("拒绝成功");
location.href = "#springUrl('/a/consultSheet/list')"
}else if (data.errorNo==0){
alert("拒绝失败");
location.href = "#springUrl('/a/consultSheet/list')"
}
}
});
}
var recdTypeAdd = function () { var recdTypeAdd = function () {
var initForm = function () { var initForm = function () {
var initFormCtrl = function () { var initFormCtrl = function () {
...@@ -141,16 +345,20 @@ ...@@ -141,16 +345,20 @@
rules: {}, rules: {},
messages: {}, messages: {},
submitHandler: function (form) { submitHandler: function (form) {
$("#save").attr("disabled", true); // $("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/consultSheet/formData')", $("#myForm").serialize(), function (returnobj) { // var dataJSON = $("#myForm").serialize();
$("#save").attr("disabled", false); var dataJSON = {};
if (returnobj.errorNo == 2) { //保存成功 dataJSON.consultId = $("#consultId").val();
dataJSON.status = "1";
$.getJSON("#springUrl('/a/consultSheet/updateStatus')",dataJSON , function (returnobj) {
// $("#save").attr("disabled", false);
if (returnobj.errorNo == 1) { //保存成功
Cfapp.confirm({ Cfapp.confirm({
message: "添加成功", message: "审核成功",
btnoktext: "继续添加",
btncanceltext: "关闭", btncanceltext: "关闭",
success: function () { success: function () {
location.href = "#springUrl('/a/consultSheet/form')"; location.href = "#springUrl('/a/consultSheet/list')";
}, },
cancel: function () { cancel: function () {
location.href = "#springUrl('/a/consultSheet/list')"; location.href = "#springUrl('/a/consultSheet/list')";
...@@ -158,15 +366,7 @@ ...@@ -158,15 +366,7 @@
}); });
} else if (returnobj.errorNo == 0) { //修改成功 } else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({ Cfapp.alert({
message: "更新成功", message: "审核失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/consultSheet/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定", btntext: "确定",
success: function () { success: function () {
location.href = "#springUrl('/a/consultSheet/list')"; location.href = "#springUrl('/a/consultSheet/list')";
...@@ -190,5 +390,6 @@ ...@@ -190,5 +390,6 @@
}(); }();
</script> </script>
</body> </body>
<!-- END BODY --> <!-- END BODY -->
</html> </html>
\ No newline at end of file
...@@ -78,11 +78,19 @@ ...@@ -78,11 +78,19 @@
<div class="box-header"> <div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/consultSheet/list')" method="get"> <form id="seachTableForm" action="#springUrl('/a/consultSheet/list')" method="get">
<div class="col-xs-5"> <div class="col-xs-5">
<button type="button" class="search btn btn-primary">搜索</button> <div class="col-xs-2">
<input type="text" class="form-control required"
name="doctorName" placeholder="用药人姓名">
</div>
<div class="col-xs-2">
<input type="text" class="form-control required"
name="illness" placeholder="病情描述">
</div>
<a href="javascript:void(0)" class="btn btn-primary search">搜索</a>
#if($shiro.hasPermission("qy:consultSheet:edit")) #if($shiro.hasPermission("qy:consultSheet:edit"))
<a href="#springUrl('/a/consultSheet/form')" class="btn btn-primary">新增</a>
<a href="#springUrl('/a/consultSheet/exportExcel')" class="btn btn-primary">导出</a> <a href="#springUrl('/a/consultSheet/exportExcel')" class="btn btn-primary">导出</a>
<a onclick="importExcel();" class="btn btn-primary">导入</a>
#end #end
</div> </div>
</form> </form>
...@@ -91,9 +99,22 @@ ...@@ -91,9 +99,22 @@
<table id="table" class="table table-bordered table-striped"> <table id="table" class="table table-bordered table-striped">
<thead> <thead>
<tr> <tr>
<td hidden="true">Id</td><th>创建时间</th> <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>
<th>操作</th> <th>操作</th>
</tr> </tr>
</thead> </thead>
<tbody id="tablebody"> <tbody id="tablebody">
</tbody> </tbody>
...@@ -150,6 +171,7 @@ ...@@ -150,6 +171,7 @@
function seachTable() { function seachTable() {
var sSource = "#springUrl('/a/consultSheet/listData')"; var sSource = "#springUrl('/a/consultSheet/listData')";
var aoData = { var aoData = {
iDisplayStart: 1, iDisplayStart: 1,
iDosplayLength: 10 iDosplayLength: 10
...@@ -173,6 +195,7 @@ ...@@ -173,6 +195,7 @@
}); });
}; };
$('#table').DataTable({ $('#table').DataTable({
"lengthChange": false, "lengthChange": false,
"searching": false, "searching": false,
...@@ -189,11 +212,46 @@ ...@@ -189,11 +212,46 @@
"mData": "id" "mData": "id"
}, },
{ {
"mData": "createTime" "mData": "consultId"
},
{
"mData": "userName"
},
{
"mData": "sex"
},
{
"mData": "iphone"
},
{
"mData": "pastRecords"
},
{
"mData": "prescription"
},
{
"mData": "illness"
},
{
"mData": "allergy"
},
{
"mData": "doctorName"
},
{
"mData": "customerName"
},
{
"mData": "status"
},
{
"mData": "description"
}, },
{ {
"mData": "id" "mData": "id"
}], }
],
"aoColumnDefs": [ "aoColumnDefs": [
{ // set default column settings { // set default column settings
'visible': false, 'visible': false,
...@@ -202,14 +260,121 @@ ...@@ -202,14 +260,121 @@
{ {
"aTargets": [1], "aTargets": [1],
"mData": "createTime", "mData": "consultId",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [2],
"mData": "userName",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [3],
"mData": "sex",
"mRender": function (a, b, c, d) { "mRender": function (a, b, c, d) {
return '<a href="#springUrl("/a/consultSheet/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + formatDates(a, "yyyy-MM-dd HH:mm:ss"); if (a==0){
+'</a>'; return "女";
}else{
return "男";
}
} }
}, },
{
"aTargets": [4],
"mData": "iphone",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [5],
"mData": "pastRecords",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [6],
"mData": "prescription",
"mRender": function (a, b, c, d) {
var html =""
html+='<img style="width: 50px;height: auto" src="'+a+'"">'
return html;
}
},
{
"aTargets": [7],
"mData": "illness",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [8],
"mData": "allergy",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [9],
"mData": "doctorName",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [10],
"mData": "customerName",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [11],
"mData": "status",
"mRender": function (a, b, c, d) {
if (a==0){
return "待审核";
}else if(a==1){
return "已通过";
}else if(a==2){
return "已拒绝";
}
}
},
{
"aTargets": [12],
"mData": "description",
"mRender": function (a, b, c, d) {
return a;
}
},
{
"aTargets": [13],
"mData": "id",
"mRender": function (a, b, c, d) {
var object = c.status;
var html = '';
if (object==0 ){
html += '#if($shiro.hasPermission("qy:consultSheet:edit"))<a href="#springUrl("/a/consultSheet/form?id=' + a + '")" class="btn green">审核</a>#end';
}else{
html += '#if($shiro.hasPermission("qy:consultSheet:view"))<a href="#springUrl("/a/consultSheet/form?id=' + a + '")" class="btn green">查看</a> #end';
}
return html
}
}
] ]
}); });
} }
...@@ -231,6 +396,7 @@ ...@@ -231,6 +396,7 @@
}); });
Cfapp.init(); Cfapp.init();
function removeData(data) { function removeData(data) {
Cfapp.confirm({ Cfapp.confirm({
message: "确定要删除吗", message: "确定要删除吗",
...@@ -262,6 +428,7 @@ ...@@ -262,6 +428,7 @@
} }
}); });
} }
function importExcel() { function importExcel() {
var templateExcelUrl = "#springUrl('/a/consultSheet/templateExcel')"; var templateExcelUrl = "#springUrl('/a/consultSheet/templateExcel')";
var importExcelUrl = "#springUrl('/a/consultSheet/importExcel')"; var importExcelUrl = "#springUrl('/a/consultSheet/importExcel')";
......
<!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>
package com.cftech.consultsheet.dao; package com.cftech.consultsheet.dao;
import com.alibaba.fastjson.JSONObject;
import com.cftech.consultsheet.model.ConsultSheet; import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.core.generic.GenericDao; import com.cftech.core.generic.GenericDao;
...@@ -11,5 +12,7 @@ import com.cftech.core.generic.GenericDao; ...@@ -11,5 +12,7 @@ import com.cftech.core.generic.GenericDao;
* @date: 2020-09-22 12:06 * @date: 2020-09-22 12:06
*/ */
public interface ConsultSheetMapper extends GenericDao<ConsultSheet> { public interface ConsultSheetMapper extends GenericDao<ConsultSheet> {
JSONObject updateDate(int consultId, String status, String description);
JSONObject updateStatus(ConsultSheet consultSheet);
} }
\ No newline at end of file
...@@ -23,6 +23,11 @@ ...@@ -23,6 +23,11 @@
<result column="description" property="description"/> <result column="description" property="description"/>
<result column="create_by" property="createBy"/> <result column="create_by" property="createBy"/>
<result column="update_by" property="updateBy"/> <result column="update_by" property="updateBy"/>
<result column="allergy" property="allergy"/>
<result column="symptom" property="symptom"/>
<result column="diagnosis" property="diagnosis"/>
<result column="doctor_name" property="doctorName"/>
<result column="customer_name" property="customerName"/>
</resultMap> </resultMap>
<sql id="sqlWhere"> <sql id="sqlWhere">
...@@ -53,6 +58,34 @@ ...@@ -53,6 +58,34 @@
</sql> </sql>
<sql id="sqlColumns"> <sql id="sqlColumns">
aidea.id,
aidea.consult_id,
aidea.user_name,
aidea.number_id,
aidea.benebit_id,
aidea.sex,
aidea.iphone,
aidea.past_records,
aidea.prescription,
aidea.doctor_id,
aidea.customer_id,
aidea.illness,
aidea.accounts_id,
aidea.del_flag,
aidea.status,
aidea.create_time,
aidea.update_time,
aidea.description,
aidea.create_by,
aidea.update_by,
aidea.allergy,
aidea.symptom,
aidea.diagnosis,
USER.doctor_name,
USER.customer_name
</sql>
<sql id="sqlColumn">
id, id,
consult_id, consult_id,
user_name, user_name,
...@@ -72,15 +105,18 @@ ...@@ -72,15 +105,18 @@
update_time, update_time,
description, description,
create_by, create_by,
update_by update_by,
</sql> allergy,
symptom,
diagnosis,
</sql>
<insert id="save" parameterType="com.cftech.consultsheet.model.ConsultSheet" useGeneratedKeys="true" <insert id="save" parameterType="com.cftech.consultsheet.model.ConsultSheet" useGeneratedKeys="true"
keyProperty="id"> keyProperty="id">
insert into t_aidea_consult_sheet insert into t_aidea_consult_sheet
( (
<include refid="sqlColumns"/> <include refid="sqlColumn"/>
) )
values values
( (
...@@ -104,19 +140,26 @@ ...@@ -104,19 +140,26 @@
now(), now(),
#{description, jdbcType=VARCHAR}, #{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT}, #{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT} #{updateBy, jdbcType=BIGINT},
#{allergy, jdbcType=VARCHAR},
#{updateBy, jdbcType=VARCHAR},
#{diagnosis,jdbcType=BIGINT}
#{doctorName, jdbcType=VARCHAR},
#{customerName,jdbcType=BIGINT}
) )
</insert> </insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap"> <select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT SELECT
<include refid="sqlColumns"/> <include refid="sqlColumns"/>
FROM t_aidea_consult_sheet t FROM t_aidea_consult_sheet aidea LEFT JOIN t_qyuser USER ON aidea.doctor_id = USER.doctor_id AND
WHERE t.id=#{id} aidea.customer_id = USER.customer_id
WHERE aidea.id=#{id}
</select> </select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer"> <select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_consult_sheet SELECT COUNT(1) FROM t_aidea_consult_sheet aidea LEFT JOIN t_qyuser USER ON aidea.doctor_id = USER.doctor_id AND
aidea.customer_id = USER.customer_id
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
</select> </select>
...@@ -124,7 +167,9 @@ ...@@ -124,7 +167,9 @@
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap"> <select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT SELECT
<include refid="sqlColumns"/> <include refid="sqlColumns"/>
FROM t_aidea_consult_sheet FROM t_aidea_consult_sheet aidea
LEFT JOIN t_qyuser USER ON aidea.doctor_id = USER.doctor_id AND
aidea.customer_id = USER.customer_id
<include refid="sqlWhere"/> <include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if> <if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if> <if test="limit>0">limit #{offset},#{limit}</if>
...@@ -153,7 +198,7 @@ ...@@ -153,7 +198,7 @@
sex = #{sex, jdbcType=BIGINT}, sex = #{sex, jdbcType=BIGINT},
</if> </if>
<if test="iPhone != null"> <if test="iPhone != null">
i_phone = #{iPhone, jdbcType=VARCHAR}, iphone = #{iPhone, jdbcType=VARCHAR},
</if> </if>
<if test="pastRecords != null"> <if test="pastRecords != null">
past_records = #{pastRecords, jdbcType=VARCHAR}, past_records = #{pastRecords, jdbcType=VARCHAR},
...@@ -191,6 +236,15 @@ ...@@ -191,6 +236,15 @@
<if test="updateBy != null"> <if test="updateBy != null">
update_by = #{updateBy, jdbcType=BIGINT}, update_by = #{updateBy, jdbcType=BIGINT},
</if> </if>
<if test="allergy != null">
allergy = #{allergy, jdbcType=VARCHAR},
</if>
<if test="symptom != null">
symptom = #{symptom, jdbcType=VARCHAR},
</if>
<if test="diagnosis != null">
diagnosis = #{diagnosis, jdbcType=BIGINT},
</if>
</set> </set>
where id=#{id,jdbcType=BIGINT} where id=#{id,jdbcType=BIGINT}
</update> </update>
...@@ -198,4 +252,6 @@ ...@@ -198,4 +252,6 @@
<update id="delete" parameterType="java.lang.Long"> <update id="delete" parameterType="java.lang.Long">
update t_aidea_consult_sheet set del_flag=1 where id=#{id,jdbcType=BIGINT} update t_aidea_consult_sheet set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>
package com.cftech.consultsheet.model; package com.cftech.consultsheet.model;
import com.alibaba.fastjson.annotation.JSONField;
import com.cftech.core.poi.ExportConfig; import com.cftech.core.poi.ExportConfig;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data; import lombok.Data;
import org.codehaus.jackson.format.DataFormatMatcher;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
...@@ -13,29 +17,31 @@ import java.util.Date; ...@@ -13,29 +17,31 @@ import java.util.Date;
* @date: 2020-09-22 12:06 * @date: 2020-09-22 12:06
*/ */
@Data @Data
public class ConsultSheet implements Serializable { public class ConsultSheet extends UserSheet implements Serializable {
/* 主键id */
/* 主键id */
private Long id; private Long id;
/* 咨询单编码 */ /* 咨询单编码 */
@ExportConfig(value = "咨询单编码", width = 100, showLevel = 1) @ExportConfig(value = "咨询单编码", width = 100, showLevel = 1)
private Long consultId; private Long consultId;
/* 用药人name */ /* 用药人name */
@ExportConfig(value = "用药人name", width = 100, showLevel = 1) @ExportConfig(value = "用药人姓名", width = 100, showLevel = 1)
private String userName; private String userName;
/* 身份证号 */ /* 身份证号 */
@ExportConfig(value = "身份证号", width = 100, showLevel = 1)
private String numberId; private String numberId;
/* 出生年月 */ /* 出生年月 */
@ExportConfig(value = "出生年月", width = 100, showLevel = 1)
@JSONField(format="yyyy-MM-dd")
private Date benebitId; private Date benebitId;
/* 性别 */ /* 性别 */
@ExportConfig(value = "性别", width = 100, showLevel = 1) @ExportConfig(value = "性别", width = 100, showLevel = 1)
private Long sex; private Long sex;
/* 手机号 */ /* 手机号 */
@ExportConfig(value = "手机号", width = 100, showLevel = 1) @ExportConfig(value = "联系电话", width = 100, showLevel = 1)
private String iPhone; private Long iPhone;
/* 疾病史 */ /* 疾病史 */
@ExportConfig(value = "疾病史", width = 100, showLevel = 1) @ExportConfig(value = "疾病史", width = 100, showLevel = 1)
private String pastRecords; private String pastRecords;
...@@ -43,19 +49,27 @@ public class ConsultSheet implements Serializable { ...@@ -43,19 +49,27 @@ public class ConsultSheet implements Serializable {
@ExportConfig(value = "处方单", width = 100, showLevel = 1) @ExportConfig(value = "处方单", width = 100, showLevel = 1)
private String Prescription; private String Prescription;
/* 药师id */ /* 药师id */
@ExportConfig(value = "药师id", width = 100, showLevel = 1)
private Long doctorId; private Long doctorId;
/* 客服id */ /* 客服id */
@ExportConfig(value = "客服id", width = 100, showLevel = 1)
private Long customerId; private Long customerId;
/* 病情描述 */ /* 病情描述 */
@ExportConfig(value = "病情描述", width = 100, showLevel = 1) @ExportConfig(value = "病情描述", width = 100, showLevel = 1)
private Long illness; private String illness;
/* 过敏史 */
@ExportConfig(value = "过敏史", width = 100, showLevel = 1)
private String allergy;
/* 本次确认症状 */
private String symptom;
/*是否已在医院确诊*/
private Long diagnosis;
/* 所属的账号 */ /* 所属的账号 */
private Long accountsId; private Long accountsId;
/* 删除标识 */ /* 删除标识 */
private boolean delFlag; private boolean delFlag;
/* 状态 */ /* 状态 */
@ExportConfig(value = "是否审核", width = 100, showLevel = 1)
private String status; private String status;
/* 创建时间 */ /* 创建时间 */
private Date createTime; private Date createTime;
...@@ -68,6 +82,8 @@ public class ConsultSheet implements Serializable { ...@@ -68,6 +82,8 @@ public class ConsultSheet implements Serializable {
/* 更新人 */ /* 更新人 */
private Long updateBy; private Long updateBy;
public ConsultSheet() { public ConsultSheet() {
this.delFlag = false; this.delFlag = false;
this.status = "0"; this.status = "0";
......
package com.cftech.consultsheet.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.util.Date;
/**
* @author :licc
* @date :Created in 2020/9/23 20:56
* @description:
*/
@Data
public class ConsultSheetVO {
/* 咨询单编码 */
@ExportConfig(value = "咨询单编码", width = 100, showLevel = 1)
private Long consultId;
/* 用药人name */
@ExportConfig(value = "用药人姓名", width = 100, showLevel = 1)
private String userName;
/* 性别 */
@ExportConfig(value = "性别", width = 100, showLevel = 1)
private String sex;
/* 手机号 */
@ExportConfig(value = "联系电话", width = 100, showLevel = 1)
private Long phone;
/* 疾病史 */
@ExportConfig(value = "疾病史", width = 100, showLevel = 1)
private String pastRecords;
/* 病情描述 */
@ExportConfig(value = "病情描述", width = 100, showLevel = 1)
private String illness;
/* 过敏史 */
@ExportConfig(value = "过敏史", width = 100, showLevel = 1)
private String allergy;
/* 状态 */
@ExportConfig(value = "是否审核", width = 100, showLevel = 1)
private String status;
/* 药师姓名*/
@ExportConfig(value = "药师姓名", width = 100, showLevel = 1)
private String doctorName;
/* 客服姓名*/
@ExportConfig(value = "客服姓名", width = 100, showLevel = 1)
private String customerName;
}
package com.cftech.consultsheet.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import org.omg.CORBA.PRIVATE_MEMBER;
/**
* @author :licc
* @date :Created in 2020/9/23 11:57
* @description:
*/
@Data
public class UserSheet {
/* 药师姓名*/
@ExportConfig(value = "药师姓名", width = 100, showLevel = 1)
private String doctorName;
/* 客服姓名*/
@ExportConfig(value = "客服姓名", width = 100, showLevel = 1)
private String customerName;
}
package com.cftech.consultsheet.service; package com.cftech.consultsheet.service;
import com.alibaba.fastjson.JSONObject;
import com.cftech.consultsheet.model.ConsultSheet; import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.core.generic.GenericService; import com.cftech.core.generic.GenericService;
import com.cftech.core.sql.Conds;
/** /**
* 咨询单Service * 咨询单Service
* *
...@@ -12,4 +15,6 @@ import com.cftech.core.generic.GenericService; ...@@ -12,4 +15,6 @@ import com.cftech.core.generic.GenericService;
public interface ConsultSheetService extends GenericService<ConsultSheet> { public interface ConsultSheetService extends GenericService<ConsultSheet> {
} }
package com.cftech.consultsheet.service.impl; package com.cftech.consultsheet.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cftech.consultsheet.dao.ConsultSheetMapper; import com.cftech.consultsheet.dao.ConsultSheetMapper;
import com.cftech.consultsheet.model.ConsultSheet; import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.consultsheet.service.ConsultSheetService; import com.cftech.consultsheet.service.ConsultSheetService;
...@@ -28,4 +29,6 @@ public GenericDao<ConsultSheet> getGenericMapper() { ...@@ -28,4 +29,6 @@ public GenericDao<ConsultSheet> getGenericMapper() {
return consultSheetMapper; return consultSheetMapper;
} }
} }
\ No newline at end of file
package com.cftech.consultsheet.web; package com.cftech.consultsheet.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.consultsheet.model.ConsultSheet; import com.cftech.consultsheet.model.ConsultSheet;
import com.cftech.consultsheet.model.ConsultSheetVO;
import com.cftech.consultsheet.service.ConsultSheetService; import com.cftech.consultsheet.service.ConsultSheetService;
import com.cftech.core.poi.ExcelKit; import com.cftech.core.poi.ExcelKit;
import com.cftech.core.scope.OrderType; import com.cftech.core.scope.OrderType;
...@@ -10,8 +12,12 @@ import com.cftech.core.sql.Conds; ...@@ -10,8 +12,12 @@ import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort; import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants; import com.cftech.core.util.Constants;
import com.cftech.sys.security.UserUtils; import com.cftech.sys.security.UserUtils;
import com.sun.deploy.util.StringUtils;
import jdk.nashorn.internal.ir.ReturnNode;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.poi.util.SystemOutLogger;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
...@@ -24,161 +30,231 @@ import javax.servlet.http.HttpServletRequest; ...@@ -24,161 +30,231 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList;
import java.util.List; import java.util.List;
/** /**
* 咨询单Controller * 咨询单Controller
* * <p>
* 权限字符串说明: * 权限字符串说明:
* 查看:public static final String CONSULTSHEET_VIEW = "qy:consultSheet:view" * 查看:public static final String CONSULTSHEET_VIEW = "qy:consultSheet:view"
* 查看:public static final String CONSULTSHEET_EDIT = "qy:consultSheet:edit" * 查看:public static final String CONSULTSHEET_EDIT = "qy:consultSheet:edit"
* *
* @author Strive * @author licc
* @date: 2020-09-22 12:06 * @date: 2020-09-22 12:06
*/ */
@Slf4j @Slf4j
@Controller @Controller
@RequestMapping("/a/consultSheet") @RequestMapping("/a/consultSheet")
public class ConsultSheetController { public class ConsultSheetController {
public static final String CONSULTSHEET_VIEW = "qy:consultSheet:view"; public static final String CONSULTSHEET_VIEW = "qy:consultSheet:view";
public static final String CONSULTSHEET_EDIT = "qy:consultSheet:edit"; public static final String CONSULTSHEET_EDIT = "qy:consultSheet:edit";
@Autowired @Autowired
private ConsultSheetService consultSheetService; private ConsultSheetService consultSheetService;
//列表页面 //列表页面
@RequiresPermissions(value = CONSULTSHEET_VIEW) @RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping("/list") @RequestMapping("/list")
public String list(HttpServletRequest request, Model model) { public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request); Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId); model.addAttribute("accountId", accountId);
return "consultSheet/consultSheetlist"; return "consultSheet/consultSheetlist";
} }
//编辑页面(新增、修改) //编辑页面(新增、修改)
@RequiresPermissions(value = CONSULTSHEET_VIEW) @RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping("/form") @RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) { public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) { if (!StringUtils.isEmpty(id)) {
ConsultSheet consultSheet = consultSheetService.fetchById(id); ConsultSheet consultSheet = consultSheetService.fetchById(id);
model.addAttribute("data", consultSheet); JSONObject object= JSON.parseObject(JSON.toJSONString(consultSheet));
} model.addAttribute("data", object);
return "consultSheet/consultSheetform"; }
} return "consultSheet/consultSheetform";
}
//提交数据(新增、修改) //提交数据(新增、修改)
@RequiresPermissions(value = CONSULTSHEET_EDIT) @RequiresPermissions(value = CONSULTSHEET_EDIT)
@RequestMapping("/formData") @RequestMapping("/formData")
@ResponseBody @ResponseBody
public JSONObject formData(ConsultSheet consultSheet, Model model, HttpServletRequest request) { public JSONObject formData(ConsultSheet consultSheet, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject(); JSONObject rtnJson = new JSONObject();
try { try {
if (consultSheet != null && consultSheet.getId() != null) { if (consultSheet != null && consultSheet.getId() != null) {
consultSheet.setUpdateBy(UserUtils.getUser().getId()); consultSheet.setUpdateBy(UserUtils.getUser().getId());
consultSheetService.update(consultSheet); consultSheetService.update(consultSheet);
rtnJson.put("errorNo", 0); rtnJson.put("errorNo", 0);
} else { } else {
consultSheet.setAccountsId(accountsId); consultSheet.setAccountsId(accountsId);
consultSheet.setDelFlag(false); consultSheet.setDelFlag(false);
consultSheet.setAccountsId(UserUtils.getmpaccounts(request)); consultSheet.setAccountsId(UserUtils.getmpaccounts(request));
consultSheet.setCreateBy(UserUtils.getUser().getId()); consultSheet.setCreateBy(UserUtils.getUser().getId());
consultSheet.setUpdateBy(UserUtils.getUser().getId()); consultSheet.setUpdateBy(UserUtils.getUser().getId());
consultSheetService.save(consultSheet); consultSheetService.save(consultSheet);
rtnJson.put("errorNo", 2); rtnJson.put("errorNo", 2);
} }
} catch (Exception e) { } catch (Exception e) {
rtnJson.put("errorNo", 1); rtnJson.put("errorNo", 1);
} }
return rtnJson; return rtnJson;
} }
//获取列表数据 //审核拒绝功能
@RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ConsultSheet consultSheet, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
conds.equal("accounts_id", accountsId);
Sort sort = new Sort("create_time", OrderType.DESC);
List<ConsultSheet> list = consultSheetService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = consultSheetService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据 @RequestMapping("/updateData")
@RequiresPermissions(value = CONSULTSHEET_EDIT) @ResponseBody
@RequestMapping("/delete") public JSONObject updateData( int consultId, String status,String description ,HttpServletRequest request) {
@ResponseBody JSONObject rtnJson = new JSONObject();
public JSONObject delete(String id) { Conds conds = new Conds();
JSONObject rtnJosn = new JSONObject(); try {
try { if (!StringUtils.isEmpty(consultId) && !StringUtils.isEmpty(status) && !StringUtils.isEmpty(description)) {
consultSheetService.delete(id); conds.equal("consult_id",consultId);
rtnJosn.put("errorNo", 0); // consultSheetService.update()
} catch (Exception e) { ConsultSheet consultSheet = consultSheetService.fetchSearchByConds(conds);
rtnJosn.put("errorNo", 1); consultSheet.setStatus(status);
} consultSheet.setDescription(description);
return rtnJosn; consultSheetService.update(consultSheet);
} rtnJson.put("errorNo", 1);
}
} catch (Exception e) {
rtnJson.put("errorNo", 0);
}
return rtnJson;
}
//审核通过功能
@RequiresPermissions(value = CONSULTSHEET_EDIT)
@RequestMapping("/updateStatus")
@ResponseBody
public JSONObject updateStatus(int consultId, String status, HttpServletRequest request) {
JSONObject rtnJson = new JSONObject();
Conds conds = new Conds();
try {
if (!StringUtils.isEmpty(consultId) && !StringUtils.isEmpty(status)) {
conds.equal("consult_id",consultId);
// consultSheetService.update()
ConsultSheet consultSheet = consultSheetService.fetchSearchByConds(conds);
consultSheet.setStatus(status);
consultSheetService.update(consultSheet);
rtnJson.put("errorNo", 1);
}
} catch (Exception e) {
rtnJson.put("errorNo", 0);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = CONSULTSHEET_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ConsultSheet consultSheet, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
if (!StringUtils.isEmpty(consultSheet.getDoctorName())){
conds.like("USER.doctor_name",consultSheet.getDoctorName());
}
if (!StringUtils.isEmpty(consultSheet.getIllness())){
conds.like("aidea.illness",consultSheet.getIllness());
}
conds.equal("aidea.del_flag", Constants.DEL_FLAG_0);
conds.equal("aidea.accounts_id", accountsId);
Sort sort = new Sort("aidea.create_time", OrderType.DESC);
List<ConsultSheet> list = consultSheetService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = consultSheetService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
System.out.println(rtnJson.toJSONString());
return rtnJson;
}
//删除数据
@RequiresPermissions(value = CONSULTSHEET_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
consultSheetService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = CONSULTSHEET_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("aidea.create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("aidea.del_flag", 0);
@RequestMapping("/exportExcel")
@RequiresPermissions(value = CONSULTSHEET_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<ConsultSheet> list = consultSheetService.fetchSearchByPage(conds, sort, 0, 0); List<ConsultSheet> list = consultSheetService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(ConsultSheet.class, response).toExcel(list, "咨询单信息"); List<ConsultSheetVO> consultSheetVOS = new LinkedList<>();
} for (ConsultSheet consultSheet : list) {
ConsultSheetVO consultSheetVO = new ConsultSheetVO();
consultSheetVO.setConsultId(consultSheet.getConsultId());
consultSheetVO.setUserName(consultSheet.getUserName());
consultSheetVO.setSex(consultSheet.getSex() == 1 ? "男" : "女");
consultSheetVO.setPhone(consultSheet.getIPhone());
consultSheetVO.setPastRecords(consultSheet.getPastRecords());
consultSheetVO.setIllness(consultSheet.getIllness());
consultSheetVO.setAllergy(consultSheet.getAllergy());
consultSheetVO.setStatus(consultSheet.getStatus().equals("0") ? "未审核" : consultSheet.getStatus().equals("1") ? "已通过" : "已拒绝");
consultSheetVO.setDoctorName(consultSheet.getDoctorName());
consultSheetVO.setCustomerName(consultSheet.getCustomerName());
consultSheetVOS.add(consultSheetVO);
}
ExcelKit.$Export(ConsultSheetVO.class, response).toExcel(consultSheetVOS, "咨询单信息");
}
@RequestMapping("/templateExcel") @RequestMapping("/templateExcel")
@RequiresPermissions(value = CONSULTSHEET_VIEW) @RequiresPermissions(value = CONSULTSHEET_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) { public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(ConsultSheet.class, response).toExcel(null, "咨询单信息"); ExcelKit.$Export(ConsultSheet.class, response).toExcel(null, "咨询单信息");
} }
@RequestMapping("/importExcel") @RequestMapping("/importExcel")
@RequiresPermissions(value = CONSULTSHEET_EDIT) @RequiresPermissions(value = CONSULTSHEET_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) { public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request); Long accountId = UserUtils.getmpaccounts(request);
if (file == null) { if (file == null) {
return list(request, model); return list(request, model);
} }
// 构造临时路径来存储上传的文件 // 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir"); String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath); File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) { if (!uploadDir.exists()) {
uploadDir.mkdir(); uploadDir.mkdir();
} }
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName; String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath); File storeFile = new File(filePath);
try { try {
file.transferTo(storeFile); file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> { ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) { if (!StringUtils.isEmpty(rowData.get(0))) {
ConsultSheet consultSheet = new ConsultSheet(); ConsultSheet consultSheet = new ConsultSheet();
consultSheet.setAccountsId(accountId); consultSheet.setAccountsId(accountId);
consultSheetService.save(consultSheet); consultSheetService.save(consultSheet);
} }
}); });
} catch (IOException e) { } catch (IOException e) {
log.error(e.getMessage()); log.error(e.getMessage());
} }
return list(request, model); return list(request, model);
} }
} }
/**
* Created by 16444 on 2020/9/22.
*/
public class TestJava {
}
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
<modules> <modules>
<module>consult-module</module> <module>consult-module</module>
<module>consult-module-web</module> <module>consult-module-web</module>
<module>product-classify-module</module>
<module>product-classify-module-web</module>
</modules> </modules>
<dependencies> <dependencies>
......
<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/maven-v4_0_0.xsd">
<parent>
<artifactId>aidea-modules</artifactId>
<groupId>com.cftech</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>product-classify-module-web</artifactId>
<packaging>war</packaging>
<name>product-classify-module-web Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-classify-module</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<finalName>product-classify-module-web</finalName>
</build>
</project>
<!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">
<!-- ztree css -->
<link rel="stylesheet"
href="plugins/ztree/css/metroStyle/metroStyle.css" type="text/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]-->
<link rel="stylesheet" href="common/css/uePicPicker.css">
</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="form-group form-md-line-input">
<label>上级分类</label>
<div class="input-group">
<input type="text" id="parentId" name="parentId" value="$!{data.parentId}"
class="form-control" style="display: none">
<input type="text" id="parentName" name="parentName" value="$!{data.parentName}"
class="form-control" required="required" disabled >
<span class="input-group-btn">
<button type="button" id="parentSelect"
class="btn btn-info btn-flat">选择</button>
</span>
</div>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>产品分类名称</label>
<input type="text" required class="form-control pull-right"
value="$!{data.classifyName}" maxlength="500" required
name="classifyName" placeholder="产品分类名称"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>产品分类编码</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.classifyNumber}" maxlength="500"
name="classifyNumber" placeholder="产品分类编码"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>序号</label>
<input type="text" required class="form-control pull-right"
value="$!{data.sort}" maxlength="500" required
name="sort" placeholder="序号"
>
</div>
<div class="form-group form-md-line-input col-md-12" id="img">
</div>
<div class="form-group form-md-line-input col-md-12">
<label>是否推荐</label>
#if($data.whetherRecommend == '是')
<input type="radio" name="whetherRecommend" value="是" checked="true"/>
<input type="radio" name="whetherRecommend" value="否"/>
#elseif($data.whetherRecommend == '否')
<input type="radio" name="whetherRecommend" value="是" />
<input type="radio" name="whetherRecommend" value="否" checked="true"/>
#else
<input type="radio" name="whetherRecommend" value="是" checked="true"/>
<input type="radio" name="whetherRecommend" value="否"/>
#end
</div>
<input type="text" style="display: none" name="_csrf" value="${_csrf.token}"/>
<input type="text" style="display: none" name="_csrf_header" value="${_csrf.headerName}"/>
<div class="form-group form-md-line-input col-md-12">
<label>备注</label>
<textarea type="text" class="form-control pull-right" maxlength="500"
name="description" placeholder="备注"
>$!{data.description}</textarea>
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:productclassify:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/productclassify/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>
<!-- ztree -->
<script src="plugins/ztree/js/jquery.ztree.all.min.js"
type="text/javascript"></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>
<script src="js/jquery.serializejson.js"></script>
<script src="plugins/jquery-validation/js/localization/messages_zh.js"></script>
<script src="plugins/Sortable/Sortable.min.js"></script>
<script src="common/component/uePicPicker.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
initPicsSel();
});
var coverPP = null;
var initPicsSel = function () {
var smallimg = "$!{data.classifyImg}";
coverPP = new uePicPicker({
tarId: 'img',
title: 'banner图',
sizeDes: '205*202',
max: 1,
datas: smallimg=='' ? null : smallimg.split(","),
success: null
});
coverPP.init();
};
var sSource = "#springUrl('/a/productclassify/treeData')";
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$('#parentSelect').on('click',
function () {
Cfapp.treeSingleSelect({
title: '上级分类选择',
url: sSource,
displayFields: 'parentName',
storeFields: 'parentId',
success: function () {
console.log('success');
},
cancel: function () {
console.log('cancel');
}
})
});
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
var data = $("#myForm").serializeJSON();
var classifyImg = coverPP.getStringValues();
var flag = true;
if(classifyImg == ''){
flag = false;
Cfapp.alert({
message: "请上传图片",
btntext: "确定",
success: function () {
return false;
}
});
}
if(flag){
data.classifyImg = classifyImg;
$("#save").attr("disabled", true);
$.post("#springUrl('/a/productclassify/formData')", data, function(returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/productclassify/form')";
},
cancel: function () {
location.href = "#springUrl('/a/productclassify/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productclassify/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productclassify/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/productclassify/list')" method="get">
<div class="col-xs-2">
<input type="text" class="form-control "
name="classifyName" placeholder="产品分类名称">
</div>
<div class="col-xs-5">
<button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:productclassify:edit"))
<a href="#springUrl('/a/productclassify/form')" 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>
<td>产品分类名称</td>
<td>产品分类编码</td>
<td>序号</td>
<td>banner图</td>
<td>是否推荐</td>
<td>备注</td>
<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>
var csrfheader = {name: '_csrf_header', value: '${_csrf.headerName}'};
var csrftoken = {name: '_csrf', value: '${_csrf.token}'};
</script>
<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/productclassify/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":"classifyName"
},
{
"mData":"classifyNumber"
},
{
"mData":"sort"
},
{
"mData":"classifyImg"
},
{
"mData":"whetherRecommend"
},
{
"mData":"description"
},
{
"mData": "createTime"
},
{
"mData": "id"
}],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets":[4],
"mData":"classifyImg",
"mRender":function(a, b, c, d){
return "<img src='"+a+"' style='width: 80px;height: 80px;'>";
}
},
{
"aTargets": [7],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return formatDates(a, "yyyy-MM-dd HH:mm:ss");
}
},
{
"aTargets": [8],
"mData": "id",
"mRender": function (a, b, c, d) {//a表示id对应的值,c表示当前记录行对象
var html = '#if($shiro.hasPermission("qy:productclassify:edit"))';//
html += '<a href="#springUrl("/a/productclassify/form?id=' + a + '")" data-id="' + a + '" data-action="view" class="btn green">修改</a>';
html += '<a href="javascript:void(0);" data-id="' + a + '" data-action="remove" onclick="removeData(' + a + ')" class="btn red">删除</a>';
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/productclassify/delete')",
data: {id: data},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/productclassify/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function importExcel() {
var templateExcelUrl = "#springUrl('/a/productclassify/templateExcel')";
var importExcelUrl = "#springUrl('/a/productclassify/importExcel')?_csrf_header=" + csrfheader.value + "&_csrf=" + csrftoken.value;
Cfapp.importExcel({
title: '产品分类导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function (retjson) {
location.href = "#springUrl('/a/productclassify/list')";
}
});
}
</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>product-classify-module</artifactId>
<dependencies>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>sys-module</artifactId>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.cftech.productclassify.dao;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.core.generic.GenericDao;
import java.util.List;
import java.util.Map;
/**
* 产品分类Mapper
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
public interface ProductclassifyMapper extends GenericDao<Productclassify> {
/**
* 查产品分类
* @param params
* @return
*/
List<Productclassify> fetchTreeByPage(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.productclassify.dao.ProductclassifyMapper">
<resultMap id="resultMap" type="com.cftech.productclassify.model.Productclassify">
<id column="id" property="id"/>
<result column="classify_name" property="classifyName"/>
<result column="classify_number" property="classifyNumber"/>
<result column="classify_img" property="classifyImg"/>
<result column="sort" property="sort"/>
<result column="whether_recommend" property="whetherRecommend"/>
<result column="parent_id" property="parentId"/>
<result column="parentName" property="parentName"/>
<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">
id,
classify_name,
classify_number,
classify_img,
sort,
whether_recommend,
parent_id,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.productclassify.model.Productclassify" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_product_classify
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{classifyName, jdbcType=VARCHAR},
#{classifyNumber, jdbcType=VARCHAR},
#{classifyImg, jdbcType=VARCHAR},
#{sort, jdbcType=VARCHAR},
#{whetherRecommend, jdbcType=VARCHAR},
#{parentId, 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="fetchTreeByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_classify
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_product_classify t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT
COUNT(1)
FROM
t_aidea_product_classify a
LEFT JOIN t_aidea_product_classify b ON b.id = a.parent_id
AND b.del_flag = '0'
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
a.id id,
a.classify_name classifyName,
a.classify_number classifyNumber,
a.classify_img classifyImg,
a.sort sort,
a.whether_recommend whetherRecommend,
a.parent_id parentId,
a.del_flag delFlag,
a.create_time createTime,
a.update_time updateTime,
a.description description,
a.create_by crateBy,
a.update_by updateBy,
b.classify_name parentName
FROM
t_aidea_product_classify a
LEFT JOIN t_aidea_product_classify b ON b.id = a.parent_id
AND b.del_flag = '0'
<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.productclassify.model.Productclassify">
update t_aidea_product_classify
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="classifyName != null">
classify_name = #{classifyName, jdbcType=VARCHAR},
</if>
<if test="classifyNumber != null">
classify_number = #{classifyNumber, jdbcType=VARCHAR},
</if>
<if test="classifyImg != null">
classify_img = #{classifyImg, jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort, jdbcType=VARCHAR},
</if>
<if test="whetherRecommend != null">
whether_recommend = #{whetherRecommend, jdbcType=VARCHAR},
</if>
<if test="parentId != null">
parent_id = #{parentId, 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_aidea_product_classify set del_flag=1 where id=#{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.productclassify.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import org.apache.cxf.jaxws.handler.types.CString;
import java.io.Serializable;
import java.util.Date;
/**
* 产品分类
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
@Data
public class Productclassify implements Serializable {
/* 主键id */
private Long id;
/* 分类名称 */
@ExportConfig(value = "分类名称", width = 100, showLevel = 2)
private String classifyName;
/* 分类编码 */
@ExportConfig(value = "分类编码", width = 100, showLevel = 2)
private String classifyNumber;
/* 分类banner图 */
@ExportConfig(value = "分类banner图", width = 100, showLevel = 1)
private String classifyImg;
/* 序号 */
@ExportConfig(value = "序号", width = 100, showLevel = 2)
private String sort;
/* 是否推荐 */
@ExportConfig(value = "是否推荐(是/否)", width = 200, showLevel = 2)
private String whetherRecommend;
/**
* 父级ID
*/
private String parentId;
/**
* 父级ID 对应的产品分类名称
*/
@ExportConfig(value = "父级编码(不填默认为第一级)", width = 300, showLevel = 2)
private String parentName;
/**
* 父级编码
*/
private String parentNumber;
/* 所属的账号 */
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 Productclassify() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.productclassify.service;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.core.generic.GenericService;
import java.util.List;
import java.util.Map;
/**
* 产品分类Service
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
public interface ProductclassifyService extends GenericService<Productclassify> {
/**
* 查找产品分类
* @param conds
* @param sort
* @param pageNo
* @param pageSize
* @return
*/
List<Productclassify> fetchTreeByPage(Conds conds , Sort sort,int pageNo , int pageSize);
}
package com.cftech.productclassify.service.impl;
import com.cftech.core.sql.Sort;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.productclassify.dao.ProductclassifyMapper;
import com.cftech.productclassify.service.ProductclassifyService;
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;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 产品分类ServiceImpl
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
@Service("productclassifyService")
public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassify> implements ProductclassifyService {
@Autowired
@Qualifier("productclassifyMapper")
private ProductclassifyMapper productclassifyMapper;
@Override
public GenericDao<Productclassify> getGenericMapper() {
return productclassifyMapper;
}
@Override
public List<Productclassify> fetchTreeByPage(Conds conds, Sort sort, int pageNo, int pageSize) {
Map<String, Object> params = new HashMap<>();
params.put("conds", conds);
params.put("offset", pageNo > 0 ? pageNo : 0);
params.put("limit", pageSize > 0 ? pageSize : 0);
params.put("sort", sort);
return productclassifyMapper.fetchTreeByPage(params);
}
}
\ No newline at end of file
package com.cftech.productclassify.web;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.core.util.SystemConfig;
import com.cftech.productclassify.model.Productclassify;
import com.cftech.productclassify.service.ProductclassifyService;
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 PRODUCTCLASSIFY_VIEW = "qy:productclassify:view"
* 查看:public static final String PRODUCTCLASSIFY_EDIT = "qy:productclassify:edit"
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
@Slf4j
@Controller
@RequestMapping("/a/productclassify")
public class ProductclassifyController {
public static final String PRODUCTCLASSIFY_VIEW = "qy:productclassify:view";
public static final String PRODUCTCLASSIFY_EDIT = "qy:productclassify:edit";
@Autowired
private ProductclassifyService productclassifyService;
@Autowired
private CodingruleUtils codingruleUtils;
private static final String fatherName = SystemConfig.p.getProperty("PRODUCT_CLASSIFY_FATHER_NAME");
//列表页面
@RequiresPermissions(value = PRODUCTCLASSIFY_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "productclassify/productclassifylist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = PRODUCTCLASSIFY_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
Productclassify productclassify = productclassifyService.fetchById(id);
if(productclassify!=null && productclassify.getParentId().equals("0")){
productclassify.setParentName(fatherName);
}else{
productclassify.setParentName(productclassifyService.fetchById(productclassify.getParentId()).getClassifyName());
}
model.addAttribute("data", productclassify);
}
return "productclassify/productclassifyform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = PRODUCTCLASSIFY_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(Productclassify productclassify, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (productclassify != null && productclassify.getId() != null) {
productclassify.setUpdateBy(UserUtils.getUser().getId());
productclassifyService.update(productclassify);
rtnJson.put("errorNo", 0);
} else {
productclassify.setClassifyNumber(codingruleUtils.getNumber(accountsId,Productclassify.class.getName()));
productclassify.setAccountsId(accountsId);
productclassify.setDelFlag(false);
productclassify.setAccountsId(UserUtils.getmpaccounts(request));
productclassify.setCreateBy(UserUtils.getUser().getId());
productclassify.setUpdateBy(UserUtils.getUser().getId());
productclassifyService.save(productclassify);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = PRODUCTCLASSIFY_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, Productclassify productclassify, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("a.del_flag", Constants.DEL_FLAG_0);
conds.equal("a.accounts_id", accountsId);
if (!StringUtils.isEmpty(productclassify.getClassifyName())) {
conds.like("a.classify_name",productclassify.getClassifyName());
}
Sort sort = new Sort("a.sort", OrderType.DESC);
List<Productclassify> list = productclassifyService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = productclassifyService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = PRODUCTCLASSIFY_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
productclassifyService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = PRODUCTCLASSIFY_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<Productclassify> list = productclassifyService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(Productclassify.class, response).toExcel(list, "产品分类信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = PRODUCTCLASSIFY_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(Productclassify.class, response).toExcel(null, "产品分类信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = PRODUCTCLASSIFY_EDIT)
@ResponseBody
public JSONObject importExcel(HttpServletRequest request, MultipartFile file, Model model) {
JSONObject retJson = new JSONObject();
Long accountId = UserUtils.getmpaccounts(request);
StringBuffer classifyNumber = new StringBuffer();
StringBuffer classifyParent = new StringBuffer();
if (file == null) {
retJson.put("errorNo", "1");
retJson.put("errorMsg", "未选择导入文件");
return retJson;
}
// 构造临时路径来存储上传的文件
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().readExcel(storeFile, rowData -> {
Conds conds = null;
Productclassify productclassify = new Productclassify();
if(!StringUtils.isEmpty(rowData.get(1))){
//获取产品分类编码 查看编码是否重复
conds = new Conds();
conds.equal("a.classify_number",rowData.get(1));
conds.equal("a.del_flag","0");
Productclassify productClassfyStr = productclassifyService.fetchSearchByConds(conds);
//不为空则产品分类编码已存在
if(productClassfyStr != null){
classifyNumber.append(" '"+rowData.get(1)+"', ");
return;
}else{
productclassify.setClassifyNumber(rowData.get(1));
}
}
if(!StringUtils.isEmpty(rowData.get(4))){
conds = new Conds();
conds.equal("a.classify_number",rowData.get(4));
conds.equal("a.del_flag","0");
Productclassify productClassifyParent = productclassifyService.fetchSearchByConds(conds);
if(productClassifyParent == null){
//父级编码不存在
classifyParent.append(" '"+rowData.get(4)+"', ");
return;
}else{
productclassify.setParentId(String.valueOf(productClassifyParent.getId()));
}
}else{
productclassify.setParentId("0");
}
//productclassify.setClassifyNumber(codingruleUtils.getNumber(accountId,Productclassify.class.getName()));
productclassify.setAccountsId(accountId);
productclassify.setClassifyName(rowData.get(0));
productclassify.setSort(rowData.get(2));
productclassify.setWhetherRecommend(rowData.get(3));
productclassifyService.save(productclassify);
});
} catch (IOException e) {
log.error(e.getMessage());
}
retJson.put("errorNo", "0");
if(classifyNumber.length() > 0){
retJson.put("errorMsg","部分产品分类导入失败,原因:产品分类编码重复:"+classifyNumber.toString());
}else if(classifyParent.length() > 0){
retJson.put("errorMsg","部分产品分类导入失败,原因:产品分类父级编码不存在:"+classifyParent.toString());
}else {
retJson.put("errorMsg","导入成功");
}
return retJson;
}
@RequestMapping("treeData")
@ResponseBody
public JSONObject getTreeData(HttpServletRequest request) {
JSONObject rtnJson = new JSONObject();
JSONArray array = new JSONArray();
Sort sort = new Sort("parent_id", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
conds.equal("accounts_id", UserUtils.getmpaccounts(request));
List<Productclassify> papercategories = productclassifyService.fetchTreeByPage(conds, sort, 0, 0);
JSONObject t = new JSONObject();
t.put("id", 0);
t.put("pId", -1);
t.put("name", fatherName);
t.put("open", true);
array.add(t);
for (Productclassify productclassify : papercategories) {
JSONObject tmp = new JSONObject();
tmp.put("id", productclassify.getId());
tmp.put("pId", productclassify.getParentId());
tmp.put("name", productclassify.getClassifyName());
array.add(tmp);
}
rtnJson.put("aaData", array);
return rtnJson;
}
}
...@@ -39,8 +39,8 @@ WOEK_TEMPLATE_MESSAGE=8m-_tt_EqoQO-wsE6_JLJdn3nO15_hgUp9mLTujz5RU ...@@ -39,8 +39,8 @@ WOEK_TEMPLATE_MESSAGE=8m-_tt_EqoQO-wsE6_JLJdn3nO15_hgUp9mLTujz5RU
userfiles.imgdir=E:\\fileResource userfiles.imgdir=E:\\fileResource
#\u56FE\u7247\u8BBF\u95EE\u5730\u5740 #\u56FE\u7247\u8BBF\u95EE\u5730\u5740
ROOT_ORG_NAME=\u827E\u8FEA\u836F\u4E1A IMAGEURL=/schaeffler/mobile/qybase/showPic?picFileName={PICFILENAME}
IMAGEURL=/aidea/mobile/qybase/showPic?picFileName={PICFILENAME} ROOT_ORG_NAME=\u4E1C\u660C\u96C6\u56E2
ROOT_PAPERCATEGORY_NAME=\u95EE\u5377\u7C7B\u578B ROOT_PAPERCATEGORY_NAME=\u95EE\u5377\u7C7B\u578B
ROOT_QUESTIONSCATEGORY_NAME=\u95EE\u9898\u7C7B\u522B ROOT_QUESTIONSCATEGORY_NAME=\u95EE\u9898\u7C7B\u522B
ROOT_MATERIALCATEGORY_NAME=\u7D20\u6750\u7C7B\u522B ROOT_MATERIALCATEGORY_NAME=\u7D20\u6750\u7C7B\u522B
...@@ -106,7 +106,6 @@ orderDeliverGoodsTemplateId=TH3I5prFYPC54M14zFJfgN4gvjx8SpJayctIHmzThwg ...@@ -106,7 +106,6 @@ orderDeliverGoodsTemplateId=TH3I5prFYPC54M14zFJfgN4gvjx8SpJayctIHmzThwg
#\u670D\u52A1\u5B8C\u6210\u901A\u77E5 #\u670D\u52A1\u5B8C\u6210\u901A\u77E5
serverEndTemplateId=7L1KIroXNxejxotFTzll-dVLdo1xbmqoiAo7UmDKWcc serverEndTemplateId=7L1KIroXNxejxotFTzll-dVLdo1xbmqoiAo7UmDKWcc
PRODUCT_CLASSIFY_FATHER_NAME=\uFFFD\uFFFD\u01B7\uFFFD\uFFFD\uFFFD\uFFFD
#\u54C1\u724C\u7533\u8BF7\u6D88\u606F\u6A21\u677F #\u54C1\u724C\u7533\u8BF7\u6D88\u606F\u6A21\u677F
brandApplyCommTemplateId=82ByH2tkWI1-jlYiWr_-CIihWsgjrvLdFvuO771FwBo brandApplyCommTemplateId=82ByH2tkWI1-jlYiWr_-CIihWsgjrvLdFvuO771FwBo
......
...@@ -14,7 +14,9 @@ log4j.appender.FILE.DatePattern='.'yyyy-MM-dd ...@@ -14,7 +14,9 @@ log4j.appender.FILE.DatePattern='.'yyyy-MM-dd
log4j.appender.FILE.layout=org.apache.log4j.PatternLayout log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
#log4j.appender.FILE.layout=org.apache.log4j.HTMLLayout #log4j.appender.FILE.layout=org.apache.log4j.HTMLLayout
log4j.appender.FILE.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH\:mm\:ss} %C{8}@(%F\:%L)\:%m%n log4j.appender.FILE.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH\:mm\:ss} %C{8}@(%F\:%L)\:%m%n
log4j.appender.A1=org.apache.log4j.RollingFileAppender
log4j.appender.A1.Encoding=UTF-8
log4j.appender.A1.File=all.log
# mybatis log # mybatis log
log4j.logger.com=DEBUG log4j.logger.com=DEBUG
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
*/ */
//var URL = base + '/ueditor-min-1.4.3/'; //var URL = base + '/ueditor-min-1.4.3/';
//var URL = 'plugins/ueditor-min-1.4.3/'; //var URL = 'plugins/ueditor-min-1.4.3/';
var URL = '/aidea/assets/adminlte/plugins/ueditor-min-1.4.3/'; var URL = '/schaeffler/assets/adminlte/plugins/ueditor-min-1.4.3/';
/** /**
* 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。 * 配置项主体。注意,此处所有涉及到路径的配置别遗漏URL变量。
......
...@@ -365,4 +365,6 @@ public class Conds { ...@@ -365,4 +365,6 @@ public class Conds {
public List<Cond> getConds() { public List<Cond> getConds() {
return conds; return conds;
} }
} }
...@@ -14,7 +14,7 @@ public class SystemConfig { ...@@ -14,7 +14,7 @@ public class SystemConfig {
try { try {
// inputStream = SystemConfig.class.newInstance().getClass() // inputStream = SystemConfig.class.newInstance().getClass()
// .getClassLoader().getResourceAsStream(""); // .getClassLoader().getResourceAsStream("");
p.load(new InputStreamReader(SystemConfig.class.getClassLoader().getResourceAsStream("/common-test.properties"), "GBK")); p.load(new InputStreamReader(SystemConfig.class.getClassLoader().getResourceAsStream("/common-test.properties"), "utf-8"));
inputStreamRedis = SystemConfig.class.newInstance().getClass() inputStreamRedis = SystemConfig.class.newInstance().getClass()
.getClassLoader().getResourceAsStream("/redis-config-test.properties"); .getClassLoader().getResourceAsStream("/redis-config-test.properties");
......
...@@ -242,9 +242,6 @@ ...@@ -242,9 +242,6 @@
#if($cosconfig.cosType == "qiniu") #if($cosconfig.cosType == "qiniu")
<option value="$cosconfig.id">七牛</option> <option value="$cosconfig.id">七牛</option>
#end #end
#if($cosconfig.cosType == "local")
<option value="$cosconfig.id">本地</option>
#end
#end #end
</select> </select>
</div> </div>
......
...@@ -69,7 +69,6 @@ ...@@ -69,7 +69,6 @@
</ol> </ol>
</section> </section>
<!-- Main content --> <!-- Main content -->
<section class="content"> <section class="content">
<div class="row"> <div class="row">
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<html> <html>
<head> <head>
<base href="#springUrl('/assets/adminlte/')"/> <base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8"> <meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title> <title>工作台</title>
<!-- Tell the browser to be responsive to screen width --> <!-- Tell the browser to be responsive to screen width -->
......
package com.cftech.mp.fans.controller; package com.cftech.mp.fans.controller;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.service.MpAccountsService; import com.cftech.accounts.service.MpAccountsService;
import com.cftech.core.scope.OrderType; import com.cftech.core.scope.OrderType;
......
...@@ -66,6 +66,7 @@ public class MpFanssController { ...@@ -66,6 +66,7 @@ public class MpFanssController {
model.addAttribute("startTime", startTime); model.addAttribute("startTime", startTime);
model.addAttribute("endTime", endTime); model.addAttribute("endTime", endTime);
model.addAttribute("mpFanssEntity", mpFanssEntity); model.addAttribute("mpFanssEntity", mpFanssEntity);
return "managefans/fansslist"; return "managefans/fansslist";
} }
......
...@@ -3,6 +3,7 @@ package com.cftech.mp.fans.model; ...@@ -3,6 +3,7 @@ package com.cftech.mp.fans.model;
import com.cftech.sys.model.BasicEntity; import com.cftech.sys.model.BasicEntity;
import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming; import com.fasterxml.jackson.databind.annotation.JsonNaming;
import lombok.Data;
import org.codehaus.jackson.map.annotate.JsonSerialize; import org.codehaus.jackson.map.annotate.JsonSerialize;
import java.util.Date; import java.util.Date;
...@@ -12,6 +13,7 @@ import java.util.Date; ...@@ -12,6 +13,7 @@ import java.util.Date;
* *
*/ */
@JsonSerialize @JsonSerialize
@Data
@JsonNaming(PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.class) @JsonNaming(PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.class)
public class MpFanssEntity extends BasicEntity{ public class MpFanssEntity extends BasicEntity{
private static final long serialVersionUID = -2537256381609738771L; private static final long serialVersionUID = -2537256381609738771L;
......
...@@ -238,12 +238,6 @@ ...@@ -238,12 +238,6 @@
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
<type>war</type> <type>war</type>
</dependency> </dependency>
<dependency>
<groupId>com.cftech</groupId>
<artifactId>product-classify-module-web</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<!--<dependency> <!--<dependency>
<groupId>com.cftech</groupId> <groupId>com.cftech</groupId>
<artifactId>fours-job-module</artifactId> <artifactId>fours-job-module</artifactId>
......
...@@ -112,19 +112,19 @@ ...@@ -112,19 +112,19 @@
maxlength="50" placeholder="组织名称" required="required" maxlength="50" placeholder="组织名称" required="required"
value="$!{data.orgName}"> value="$!{data.orgName}">
</div> </div>
<!--<div class="form-group form-md-line-input">--> <div class="form-group form-md-line-input">
<!--<label>组织分类</label>--> <label>组织分类</label>
<!--<div class="input-group">--> <div class="input-group">
<!--<input type="text" id="orgtypeId" name="orgtypeId" value="$!{data.orgtypeId}"--> <input type="text" id="orgtypeId" name="orgtypeId" value="$!{data.orgtypeId}"
<!--class="form-control" style="display: none">--> class="form-control" style="display: none">
<!--<input type="text" id="orgtypeName" name="orgtypeName" value="$!{orgtypeName}"--> <input type="text" id="orgtypeName" name="orgtypeName" value="$!{orgtypeName}"
<!--class="form-control" disabled>--> class="form-control" disabled>
<!--<span class="input-group-btn">--> <span class="input-group-btn">
<!--<button type="button" id="orgtypeSelect"--> <button type="button" id="orgtypeSelect"
<!--class="btn btn-info btn-flat">选择</button>--> class="btn btn-info btn-flat">选择</button>
<!--</span>--> </span>
<!--</div>--> </div>
<!--</div>--> </div>
<!--<div class="checkbox">--> <!--<div class="checkbox">-->
<!--<label>--> <!--<label>-->
<!--<input type="checkbox" id="isAdminUnit" name="isAdminUnit"--> <!--<input type="checkbox" id="isAdminUnit" name="isAdminUnit"-->
......
...@@ -105,7 +105,7 @@ public class OrgUnitController { ...@@ -105,7 +105,7 @@ public class OrgUnitController {
//提交编辑页面(新增、修改) //提交编辑页面(新增、修改)
@RequiresPermissions(value = PermissionSign.ORGUNIT_EDIT) @RequiresPermissions(value = PermissionSign.ORGUNIT_EDIT)
@RequestMapping(value = "/formData") @RequestMapping(value = "/formData",method = {RequestMethod.POST})
@ResponseBody @ResponseBody
public JSONObject formData(OrgUnit orgUnit, Model model, HttpServletRequest request) { public JSONObject formData(OrgUnit orgUnit, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request); Long accountsId = UserUtils.getmpaccounts(request);
...@@ -123,20 +123,20 @@ public class OrgUnitController { ...@@ -123,20 +123,20 @@ public class OrgUnitController {
orgUnit.setParentIds("0," + orgUnit.getId() + ","); orgUnit.setParentIds("0," + orgUnit.getId() + ",");
} }
//同步至企业号 // 2017-10-27 取消同步企业号,组织功能
if (StringUtils.isEmpty(orgUnit.getWxorgId())) { // if (StringUtils.isEmpty(orgUnit.getWxorgId())) {
int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit); // int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
if (wxorgid == -1) { // if (wxorgid == -1) {
log.error("同步微信端出错," + orgUnit.toString()); // log.error("同步微信端出错," + orgUnit.toString());
} else { // } else {
orgUnit.setWxorgId("" + wxorgid); // orgUnit.setWxorgId("" + wxorgid);
//
} // }
} else { // } else {
if (!qyOrgUtil.update(orgUnit)) { // if (!qyOrgUtil.update(orgUnit)) {
log.error("同步微信端出错," + orgUnit.toString()); // log.error("同步微信端出错," + orgUnit.toString());
} // }
} // }
orgUnitService.updateCache(orgUnit); orgUnitService.updateCache(orgUnit);
rtnJson.put("errorNo", 0); rtnJson.put("errorNo", 0);
...@@ -157,13 +157,14 @@ public class OrgUnitController { ...@@ -157,13 +157,14 @@ public class OrgUnitController {
orgUnit.setUpdateBy(UserUtils.getUser().getId()); orgUnit.setUpdateBy(UserUtils.getUser().getId());
orgUnitService.saveCache(orgUnit); orgUnitService.saveCache(orgUnit);
int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit); // 2017-10-27 取消同步企业号,组织功能
if (wxorgid == -1 || wxorgid == 0) { // int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
rtnJson.put("errorNo", 1); // if (wxorgid == -1 || wxorgid == 0) {
throw new Exception("同步微信端出错"); // rtnJson.put("errorNo", 1);
} else { // throw new Exception("同步微信端出错");
orgUnit.setWxorgId("" + wxorgid); // } else {
} // orgUnit.setWxorgId("" + wxorgid);
// }
orgUnit.setParentIds(orgUnit.getParentIds() + orgUnit.getId() + ","); orgUnit.setParentIds(orgUnit.getParentIds() + orgUnit.getId() + ",");
orgUnitService.updateCache(orgUnit); orgUnitService.updateCache(orgUnit);
......
...@@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit; ...@@ -23,8 +23,8 @@ import java.util.concurrent.TimeUnit;
/** /**
* 企业号 ACCESS TOKEN 管理 * 企业号 ACCESS TOKEN 管理
*
* @author Neil * @author Neil
*
*/ */
@Slf4j @Slf4j
@Component @Component
...@@ -35,6 +35,8 @@ public class QyTokenUtil { ...@@ -35,6 +35,8 @@ public class QyTokenUtil {
@Autowired @Autowired
private RedisTemplate<String, String> redisTemplate; private RedisTemplate<String, String> redisTemplate;
// @Autowired
// private WebHttpInterface webHttpInterface;
private RedisTemplate<String, String> getConfig() { private RedisTemplate<String, String> getConfig() {
StringRedisSerializer stringSerializer = new StringRedisSerializer(); StringRedisSerializer stringSerializer = new StringRedisSerializer();
...@@ -44,10 +46,9 @@ public class QyTokenUtil { ...@@ -44,10 +46,9 @@ public class QyTokenUtil {
redisTemplate.setHashValueSerializer(stringSerializer); redisTemplate.setHashValueSerializer(stringSerializer);
return redisTemplate; return redisTemplate;
} }
/** /**
* 通过企业号corpid刷新最新的token,并返回
* *
* 通过企业号corpid刷新最新的token,并返回
* @return * @return
*/ */
public String getToken(Long accountId)//更新token public String getToken(Long accountId)//更新token
...@@ -63,14 +64,13 @@ public class QyTokenUtil { ...@@ -63,14 +64,13 @@ public class QyTokenUtil {
if (getConfig().hasKey(key)) { if (getConfig().hasKey(key)) {
return getConfig().opsForValue().get(key); return getConfig().opsForValue().get(key);
} }
String token = null;
try {
// 请求企业号认证信息 // 请求企业号认证信息
String url = WxApiConstants.TOKEN_GET.replace("CORPID", accountsEntity.getAppid()) String url = WxApiConstants.TOKEN_GET.replace("CORPID", accountsEntity.getAppid())
.replace("SECRECT", accountsEntity.getSecret()); .replace("SECRECT", accountsEntity.getSecret());
String retStr = OKHttpUtils.getJSON(url); // String retStr = OKHttpUtils.getJSON(url);
JSONObject retObj = JSON.parseObject(retStr); // JSONObject retObj = JSON.parseObject(retStr);
token = retObj.getString("access_token");// 缓存token至redis // String token = retObj.getString("access_token");// 缓存token至redis
String token = "1";// webHttpInterface.getValue(url,"access_token");
getConfig().opsForValue().set(key, token); getConfig().opsForValue().set(key, token);
...@@ -78,16 +78,14 @@ public class QyTokenUtil { ...@@ -78,16 +78,14 @@ public class QyTokenUtil {
// 继续缓存jsticket // 继续缓存jsticket
url = WxApiConstants.JSAPI_TICKET_GET.replace("ACCESS_TOKEN", token); url = WxApiConstants.JSAPI_TICKET_GET.replace("ACCESS_TOKEN", token);
retStr = OKHttpUtils.getJSON(url); // retStr = OKHttpUtils.getJSON(url);
retObj = JSON.parseObject(retStr); // retObj = JSON.parseObject(retStr);
String jsTicket = retObj.getString("ticket"); // String jsTicket = retObj.getString("ticket");
String jsTicket = "1";// webHttpInterface.getValue(url,"ticket");
// 缓存token至redis // 缓存token至redis
getConfig().opsForValue().set(jskey, jsTicket); getConfig().opsForValue().set(jskey, jsTicket);
getConfig().expire(jskey, 6000, TimeUnit.SECONDS); getConfig().expire(jskey, 6000, TimeUnit.SECONDS);
} catch (IOException e) {
e.printStackTrace();
}
return token; return token;
} }
...@@ -146,7 +144,7 @@ public class QyTokenUtil { ...@@ -146,7 +144,7 @@ public class QyTokenUtil {
/** /**
* 通过主键ID,获取公众号实体 * 通过主键ID,获取公众号实体
*/ */
public MpAccountsEntity searchAccountsById(Long id) { public MpAccountsEntity searchAccountsById(Long id){
MpAccountsEntity accountsEntity = accountService.getDetail(id); MpAccountsEntity accountsEntity = accountService.getDetail(id);
return accountsEntity; return accountsEntity;
} }
...@@ -154,7 +152,7 @@ public class QyTokenUtil { ...@@ -154,7 +152,7 @@ public class QyTokenUtil {
/** /**
* 通过appid,获取公众号实体 * 通过appid,获取公众号实体
*/ */
public MpAccountsEntity searchAccounts(String appid) { public MpAccountsEntity searchAccounts(String appid){
MpAccountsEntity accountsEntity = accountService.getMpAccountsAppid(appid); MpAccountsEntity accountsEntity = accountService.getMpAccountsAppid(appid);
return accountsEntity; return accountsEntity;
} }
......
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