Commit 6500ef22 authored by 谢希宇's avatar 谢希宇

Submit by Strive

Date 2021/04/15
Project End
parent eac85f6a
......@@ -413,10 +413,8 @@
"aTargets": [6],
"mData": "isThree",
"mRender": function (a, b, c, d) {
if (a == '0') {
if (a == '1') {
return '三期';
} else if (a == '1') {
return '四期';
} else {
return '';
}
......@@ -595,7 +593,7 @@
* 动态展示背景颜色
*/
function RowCallBack(row, data, index) {
if (data.isThree == '0') {
if (data.isThree == '1') {
$('td', row).eq(5).css('background-color', "RGB(249,203,132)");
}
}
......
......@@ -217,7 +217,7 @@
SELECT
<include refid="sqlColumns"/>,
o.number orderCode,
au.status isThree,
m.status isThree,
(SELECT status FROM t_order sales WHERE sales.del_flag = '0' AND sales.status = '4' AND sales.openid = a.open_id LIMIT 1) isSales,
f.store fansAlias,
o.status orderStatus,
......@@ -226,8 +226,7 @@
LEFT JOIN t_order o ON a.order_id = o.id
LEFT JOIN t_qyuser b ON b.id = a.doctor_id AND b.del_flag = '0'
LEFT JOIN t_qyuser c ON c.id = a.service_id AND c.del_flag = '0'
LEFT JOIN wx_mp_member m ON m.open_id = a.open_id AND m.del_flag = '0'
LEFT JOIN t_aidea_authentication au ON m.cardid = au.id_card AND au.del_flag = '0'
LEFT JOIN wx_mp_member m ON m.open_id = a.open_id AND m.del_flag = '0' AND m.status != '0'
LEFT JOIN wx_mp_fanss f ON f.openid = a.open_id AND f.delflag = '0'
<include refid="sqlWhere"/>
<if test="userid!=null">AND (a.doctor_id = ${userid} or a.service_id =${userid})</if>
......
......@@ -25,6 +25,7 @@ import com.cftech.mp.fans.service.MpFanssService;
import com.cftech.order.model.Order;
import com.cftech.order.service.OrderService;
import com.cftech.sys.security.UserUtils;
import com.cftech.sys.service.RoleService;
import com.google.gson.Gson;
import org.mp.api.core.req.model.message.IndustryTemplateMessageSend;
import org.mp.api.core.req.model.message.TemplateData;
......@@ -95,6 +96,9 @@ public class ConsultSheetController {
@Autowired
private QyMsgUtil qyMsgUtil;
@Autowired
private RoleService roleService;
/**
* 咨询单列表
* @param request
......@@ -209,6 +213,10 @@ public class ConsultSheetController {
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, ConsultSheet consultSheet, HttpServletRequest request) {
Long userid = UserUtils.getUser().getUserid();
boolean leader = roleService.selectRoleEntityByUserId(userid, Constants.SYSTEM_LEADER);
if (leader) {
userid = 1L;//查看全部
}
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
......
......@@ -69,8 +69,8 @@ public class couponInvalidMsgRemindJob implements Job {
String refuseTmpId = SystemConfig.p.getProperty("CHECK_COUPON_TAKE_EFFECT_REMIND_TEMPLATE_MSG");
String first = "您好,您的检测服务已生效!";
String remark = "请您在有效期内至适用采血医院采血,点击详情查看!";
String times = DateFormatUtils.getDateFormat(couponrecord.getTakeEffectDate(), "yyyy-MM-dd") + "-"
+ DateFormatUtils.getDateFormat(couponrecord.getExpireDate(), "yyyy-MM-dd");
String times = DateFormatUtils.getDateFormat(couponrecord.getTakeEffectDate(), "yyyy年MM月dd日") + "至"
+ DateFormatUtils.getDateFormat(couponrecord.getExpireDate(), "yyyy年MM月dd日");
String[] keywords = {couponrecord.getNickName(), couponrecord.getNumber(), times};//检测结果
String url = SystemConfig.p.getProperty("MOBILE_MP_DOMAIN_NAME") + "/jcjTobeused?appid="+appid+"&tokenId=1&id="+couponrecord.getId();
sendMessage(refuseTmpId, token, couponrecord.getOpenid(), first, remark, keywords, url);
......@@ -113,4 +113,5 @@ public class couponInvalidMsgRemindJob implements Job {
json.append("}}");
JwTemplateMessageAPI.sendTemplateMsgJson(json.toString(),token);
}
}
......@@ -76,8 +76,7 @@
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
<div class="form-group form-md-line-input col-md-12">
<div class="form-group form-md-line-input col-md-6">
<label>开票编码</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.number}" maxlength="500" required
......@@ -85,31 +84,15 @@
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>发票抬头</label>
<div class="form-group form-md-line-input col-md-6">
<label>订单编码</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.invoiceTitle}" maxlength="500" required
name="productName" placeholder="发票抬头"
value="$!{data.orderId}" maxlength="500" required
name="orderId" 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.status}" maxlength="500" required-->
<!-- name="status" 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.invoiceContent}" maxlength="500" required-->
<!-- name="invoiceContent" placeholder="发票内容"-->
<!-- >-->
<!-- </div>-->
<div class="form-group form-md-line-input col-md-12">
<div class="form-group form-md-line-input col-md-6">
<label>发票类型</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.invoiceType}" maxlength="500" required
......@@ -117,39 +100,36 @@
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>来源</label>
<div class="form-group form-md-line-input col-md-6">
<label>发票抬头</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.invoiceForm}" maxlength="500" required
name="invoiceForm" placeholder="来源"
value="$!{data.invoiceTitle}" maxlength="500" required
name="productName" placeholder="发票抬头"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>发票内容</label>
<div class="form-group form-md-line-input col-md-6">
<label>发票状态</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.invoiceContent}" maxlength="500" required
name="invoiceContent" placeholder="发票内容"
#if($!{data.status}== '0') value="申请成功"
#elseif($!{data.status} == '2') value="开票成功"
#elseif($!{data.status} == '20') value="开票中"
#elseif($!{data.status} == '22') value="开票失败"
#else value="开票失败" #end
maxlength="500" required
name="status" 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.clerkId}" maxlength="500" required-->
<!-- name="clerkId" placeholder="开票人"-->
<!-- >-->
<!-- </div>-->
<div class="form-group form-md-line-input col-md-12">
<label>openId</label>
<div class="form-group form-md-line-input col-md-6">
<label>来源</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.openId}" maxlength="500" required
name="openId" placeholder="openId"
value="$!{data.invoiceForm}" maxlength="500" required
name="invoiceForm" placeholder="来源"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<div class="form-group form-md-line-input col-md-6">
<label>操作人</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.operator}" maxlength="500" required
......@@ -157,23 +137,23 @@
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>订单编码</label>
<div class="form-group form-md-line-input col-md-6">
<label>openId</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.orderId}" maxlength="500" required
name="orderId" placeholder="订单编码"
value="$!{data.openId}" maxlength="500" required
name="openId" placeholder="openId"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<label>推送方式</label>
<div class="form-group form-md-line-input col-md-6">
<label>发票流水号</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.pushMode}" maxlength="500" required
name="pushMode" placeholder="推送方式"
value="$!{data.invoiceSerialNum}" maxlength="500" required
name="invoiceSerialNum" placeholder="发票流水号"
>
</div>
<div class="form-group form-md-line-input col-md-12">
<div class="form-group form-md-line-input col-md-6">
<label>推送邮箱</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.email}" maxlength="500" required
......@@ -182,17 +162,18 @@
</div>
<div class="form-group form-md-line-input col-md-12">
<label>发票流水号</label>
<label>失败原因</label>
<input type="text" required class="form-control pull-right" readonly
value="$!{data.invoiceSerialNum}" maxlength="500" required
name="invoiceSerialNum" placeholder="发票流水号"
value="$!{data.invoiceContent}" maxlength="500" required
name="invoiceContent" 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.description}" maxlength="500" required
value="$!date.format('yyyy-MM-dd HH:mm:ss ',$!data.createTime)" maxlength="500"
required
name="description" placeholder="创建时间"
>
</div>
......
......@@ -102,28 +102,14 @@
<thead>
<tr>
<th hidden="true">Id</th>
<!-- <td>开票编码</td>-->
<!-- <td>发票抬头</td>-->
<!-- <td>抬头类型</td>-->
<!-- <td>发票内容</td>-->
<!-- <td>单位税号</td>-->
<!-- <td>发票类型</td>-->
<!-- <td>来源</td>-->
<!-- <td>开票人</td>-->
<!-- <td>openId</td>-->
<!-- <td>操作人</td>-->
<!-- <td>订单编码</td>-->
<!-- <td>推送方式</td>-->
<!-- <td>推送邮箱</td>-->
<!-- <td>发票流水号</td>-->
<!-- <th>创建时间</th>-->
<th>订单编码</th>
<th>抬头类型</th>
<th>发票状态</th>
<th>发票抬头</th>
<th>来源</th>
<!-- <th>开票人</th>-->
<th>别名</th>
<th>操作人</th>
<th>推送邮箱</th>
<th style="width: 220px;">失败原因</th>
<th>开票时间</th>
<th>操作</th>
</tr>
......@@ -169,6 +155,9 @@
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
var csrf = '${_csrf.token}';
var csrf_header = '${_csrf.headerName}';
function formatDates(now) {
var now = new Date(now);
var year = now.getFullYear();
......@@ -225,160 +214,94 @@
"mData": "id"
},
{
"mData":"orderId"
"mData": "orderId"
},
{
"mData": "status"
},
{
"mData":"invoiceTitle"
"mData": "invoiceTitle"
},
{
"mData":"invoiceForm"
"mData": "invoiceForm"
},
// {
// "mData":"clerkId"
// },
{
"mData":"aliasName"
"mData": "aliasName"
},
{
"mData":"operator"
"mData": "operator"
},
{
"mData":"email"
"mData": "email"
},
{
"mData": "invoiceContent"
},
{
"mData": "createTime"
},
// {
// "mData":"number"
// },
// {
// "mData":"invoiceTitle"
// },
// {
// "mData":"status"
// },
// {
// "mData":"invoiceContent"
// },
// {
// "mData":"unitTaxNumber"
// },
// {
// "mData":"invoiceType"
// },
// {
// "mData":"invoiceForm"
// },
// {
// "mData":"clerkId"
// },
// {
// "mData":"openId"
// },
// {
// "mData":"operator"
// },
// {
// "mData":"orderId"
// },
// {
// "mData":"pushMode"
// },
// {
// "mData":"email"
// },
// {
// "mData":"invoiceSerialNum"
// },
// {
// "mData": "createTime"
// },
{
"mData":"id"
"mData": "id"
}],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
// {
// "aTargets": [3] ,
// "mData" : "status",
// "mRender" : function (a, b, c, d){
// if (a == 0){
// return "个人";
// }else if (a == 1){
// return "企业";
// }else{
// return "";
// }
// }
// },
//
// {
// "aTargets": [6],
// "mData": "invoiceType",
// "mRender": function (a, b, c, d) {
// if (a == 1){
// return "蓝票";
// }else if (a == 2){
// return "红票";
// }else{
// return "";
// }
//
// }
// },
{
"aTargets": [3],
"aTargets": [2],
"mData": "status",
"mRender": function (a, b, c, d) {
let statusStr = "";
switch (a) {
case '0':
statusStr = '申请成功';
break;
case '2':
statusStr = '开票成功';
break;
case '20':
statusStr = '开票中';
break;
case '22':
statusStr = '开票失败';
break;
default:
statusStr = '其他';
}
return statusStr;
}
},
{
"aTargets": [4],
"mData": "invoiceForm",
"mRender": function (a, b, c, d) {
if (a == 0){
if (a == 0) {
return "移动端";
}else if (a == 1){
return "后台";
}else{
} else if (a == 1) {
return "PC端";
} else {
return "";
}
}
},
// {
// "aTargets": [12],
// "mData": "pushMode",
// "mRender": function (a, b, c, d) {
// if (a == 0){
// return "邮箱";
// } else{
// return "";
// }
//
// }
// },
{
"aTargets": [7],
"aTargets": [9],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return formatDates(a, "yyyy-MM-dd HH:mm:ss");
}
},
{
"aTargets": [8],
"aTargets": [10],
"mData": "id",
"mRender": function (a, b, c, d) {
var html = '#if($shiro.hasPermission("qy:invoice:edit"))';
// html += '<div class="btn-group" style="min-width: 100px;">\n' +
// //'<button type="button" class="btn btn-success btn-flat">操作</button>\n' +
// '<button type="button" class="btn btn-success btn-flat dropdown-toggle" data-toggle="dropdown">\n' +
// ' <span class="caret"></span>\n' +
// ' <span class="sr-only">Toggle Dropdown</span>\n' +
// '</button>\n' +
// '<ul class="dropdown-menu" role="menu" style="min-width: 100px;">\n';
html += '<a href="#springUrl("/a/invoice/form?id=' + a + '")" class="btn green">查看</a>';
// html += '</ul>';
if (c.status == '22') {
html += '<a href="javascript:void(0)" onclick="send('+ a +')" class="btn green">重推</a>';
}
html += '#end';
return html;
}
......@@ -406,21 +329,31 @@
Cfapp.init();
function removeData(data) {
function send(data) {
Cfapp.confirm({
message: "确定要删除吗",
message: "确认重新推送发票?",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
$.ajax({
type: "POST",
url: "#springUrl('/a/invoice/delete')",
data: {id: data},
url: "#springUrl('/a/invoice/send')",
data: {id: data,
_csrf: csrf,
_csrf_header: csrf_header,},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
message: "推送成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/invoice/list')";
}
});
} else if (data.errorNo == 1) {
Cfapp.alert({
message: data.errorMsg,
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/invoice/list')";
......
package com.cftech.invoice.job;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.SysJob;
import com.cftech.accounts.service.JobService;
import com.cftech.core.sql.Conds;
import com.cftech.core.util.Constants;
import com.cftech.core.util.SpringContextHolder;
import com.cftech.core.util.StringUtils;
import com.cftech.core.util.SystemConfig;
import com.cftech.invoice.model.Invoice;
import com.cftech.invoice.service.InvoiceService;
import com.cftech.invoice.web.InvoiceHttpUtil;
import lombok.extern.slf4j.Slf4j;
import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.text.SimpleDateFormat;
import java.util.List;
/**
* 批量拉取申请开票或开票中的数据
*/
@Slf4j
public class InvoiceJob implements Job {
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
boolean isCluster = Boolean.valueOf(SystemConfig.p.getProperty("quartz.isCluster"));
if (!isCluster) {
return;
}
//获得明细数据
JobDataMap jobInfo = context.getJobDetail().getJobDataMap();
String id = jobInfo.get("uid") == null ? "" : jobInfo.getString("uid");//这个也是ID主键
log.info("任务ID:" + id);
InvoiceService invoiceService = SpringContextHolder.getBean(InvoiceService.class);
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.in("t.status", new String[]{"0", "20"});//已申请、开票中
conds.isNull("t.invoice_code");
conds.isNull("t.invoice_num");
List<Invoice> invoiceList = invoiceService.fetchSearchByPage(conds, null, 0, 0);
for (Invoice invoice: invoiceList) {
String result = InvoiceHttpUtil.queryInvoiceResult(invoice);
if (StringUtils.isNotBlank(result) && result.contains("code")) {
JSONObject obj = JSONObject.parseObject(result);
if (obj.getString("code").equals("E0000")) {
JSONArray arr = obj.getJSONArray("result");
for (int i = 0; i < arr.size(); i++) {
JSONObject invoiceObj = arr.getJSONObject(i);
if (invoice.getInvoiceSerialNum().equals(invoiceObj.getString("serialNo")) && invoiceObj.getString("status").equals("2")) {
invoice.setStatus(invoiceObj.getString("status"));//status=2 开票成功
invoice.setInvoiceCode(invoiceObj.getString("invoiceCode"));
invoice.setInvoiceNum(invoiceObj.getString("invoiceNo"));
invoice.setOrderAmount(invoiceObj.getString("orderAmount"));
invoice.setImageUrl(invoiceObj.getString("pictureUrl"));
invoice.setPdfUrl(invoiceObj.getString("pdfUrl"));
invoice.setDescription(result);
invoiceService.update(invoice);
} else if (invoice.getInvoiceSerialNum().equals(invoiceObj.getString("serialNo")) && !invoiceObj.getString("status").equals("2")) {
invoice.setStatus(invoiceObj.getString("status"));//status!=2 开票失败
invoice.setInvoiceContent(invoiceObj.getString("failCause"));
invoice.setDescription(result);
invoiceService.update(invoice);
}
}
}
}
}
//执行更新操作
if (context.getNextFireTime() != null) {
log.info("批量拉取已申请、开票中发票数据:下次执行时间=====" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(context.getNextFireTime()) + "==============");
} else {
JobService jobService = SpringContextHolder.getBean(JobService.class);
SysJob sysJob = new SysJob();
sysJob.setJobuid(id);
sysJob.setStatus("0");
jobService.updateStatus(sysJob);
log.info("批量拉取已申请、开票中发票数据,已执行完成!");
}
}
}
......@@ -18,49 +18,53 @@ public class Invoice implements Serializable {
/** 主键id */
private Long id;
private String number;
/** 订单ID */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderId;
/** 状态 */
@ExportConfig(value = "发票状态", width = 100, showLevel = 1)
private String status;
/** 发票类型 */
@ExportConfig(value = "发票类型", width = 100, showLevel = 1)
private String invoiceType;
/** 发票抬头 */
@ExportConfig(value = "发票抬头", width = 100, showLevel = 1)
private String invoiceTitle;
/** 发票内容 */
@ExportConfig(value = "发票内容", width = 100, showLevel = 1)
private String invoiceContent;
/** 单位税号 */
@ExportConfig(value = "单位税号", width = 100, showLevel = 1)
private String unitTaxNumber;
/** 发票类型(1:蓝票,2红票) */
@ExportConfig(value = "发票类型", width = 100, showLevel = 1)
private String invoiceType;
/** 来源(0:移动端 1:后台) */
/** 发票流水号 */
@ExportConfig(value = "发票流水号", width = 100, showLevel = 1)
private String invoiceSerialNum;
/** 来源(0:移动端 1:PC端) */
@ExportConfig(value = "来源", width = 100, showLevel = 1)
private String invoiceForm;
/** 开票人(移动端传opendId,后台传userid) */
@ExportConfig(value = "开票人", width = 100, showLevel = 1)
/** 别名 */
@ExportConfig(value = "别名", width = 100, showLevel = 1)
private String aliasName;
/** 开票人 */
@ExportConfig(value = "操作人", width = 100, showLevel = 1)
private String operator;
/** 订单ID */
@ExportConfig(value = "订单编码", width = 100, showLevel = 1)
private String orderId;
/** 推送方式(0:邮箱) */
@ExportConfig(value = "推送方式", width = 100, showLevel = 1)
private String pushMode;
/** 推送邮箱 */
@ExportConfig(value = "推送邮箱", width = 100, showLevel = 1)
private String email;
/** 发票流水号 */
@ExportConfig(value = "发票流水号", width = 100, showLevel = 1)
private String invoiceSerialNum;
/** 商品ID 逗号隔开 */
/** 发票内容 */
@ExportConfig(value = "失败原因", width = 100, showLevel = 1)
private String invoiceContent;
/** 创建时间 */
@ExportConfig(value = "失败原因", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd")
private Date createTime;
/** 商品ID */
private String productId;
/** 所属的账号 */
private Long accountsId;
/** 删除标识 */
private boolean delFlag;
/** 状态 */
/**
* 状态( 0:个人 1:企业 )
*/
private String status;
/** 创建时间 */
private Date createTime;
/** 更新时间 */
private Date updateTime;
/** 备注 */
......@@ -93,8 +97,7 @@ public class Invoice implements Serializable {
//pdf路径
private String pdfUrl;
//别名
private String aliasName;
public Invoice() {
this.delFlag = false;
......
......@@ -136,9 +136,12 @@ public class InvoiceServiceImpl extends GenericServiceImpl<Invoice> implements I
invoice.setImageUrl(invoiceObj.getString("pictureUrl"));
invoice.setPdfUrl(invoiceObj.getString("pdfUrl"));
invoice.setDescription(result);
invoice.setStatus(invoiceObj.getString("status"));// stauts=2 开票成功
invoiceMapper.update(invoice);
} else if (invoice.getInvoiceSerialNum().equals(invoiceObj.getString("serialNo")) && !invoiceObj.getString("status").equals("2")) {
invoice.setDescription(result);
invoice.setStatus(invoiceObj.getString("status"));// stauts!=2 开票失败
invoice.setInvoiceContent(invoiceObj.getString("failCause"));
invoiceMapper.update(invoice);
retObj.put("errorNo", 1);
retObj.put("errorMsg", invoiceObj.getString("statusMsg"));
......
......@@ -64,22 +64,15 @@ public class InvoiceController {
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
Invoice invoice = invoiceService.fetchById(id);
if (!StringUtils.isEmpty(invoice.getInvoiceType())){
invoice.setInvoiceType(invoice.getInvoiceType().equals("1") ? "企业" : "个人");
if (!StringUtils.isEmpty(invoice.getInvoiceType())) {
invoice.setInvoiceType(invoice.getInvoiceType().equals("0") ? "个人" : "企业");
}
if (!StringUtils.isEmpty(invoice.getInvoiceForm())){
invoice.setInvoiceForm(invoice.getInvoiceForm().equals("0") ? "移动端" : "后台");
if (!StringUtils.isEmpty(invoice.getInvoiceForm())) {
invoice.setInvoiceForm(invoice.getInvoiceForm().equals("0") ? "移动端" : "PC端");
}
if (!StringUtils.isEmpty(invoice.getPushMode())){
if (!StringUtils.isEmpty(invoice.getPushMode())) {
invoice.setPushMode(invoice.getPushMode().equals("0") ? "邮箱" : "");
}
// if (!StringUtils.isEmpty(invoice.getStatus())){
// invoice.setStatus(invoice.getStatus().equals("0") ? "个人" : "企业");
// }
if (invoice.getCreateTime() != null){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
invoice.setDescription(format.format(invoice.getCreateTime()));
}
model.addAttribute("data", invoice);
}
return "invoice/invoiceform";
......@@ -121,7 +114,7 @@ public class InvoiceController {
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.accounts_id", accountsId);
if (!StringUtils.isEmpty(invoice.getInvoiceTitle())){
if (!StringUtils.isEmpty(invoice.getInvoiceTitle())) {
conds.like("t.invoice_title", invoice.getInvoiceTitle());
}
if (StringUtils.isNoneBlank(invoice.getOrderId())) {
......@@ -154,25 +147,76 @@ public class InvoiceController {
return rtnJosn;
}
//重推发票
@RequiresPermissions(value = INVOICE_EDIT)
@RequestMapping("/send")
@ResponseBody
public JSONObject send(String id) {
JSONObject rtnJosn = new JSONObject();
try {
Invoice invoice = invoiceService.fetchById(id);
if (invoice != null) {
String result = InvoiceHttpUtil.resetSendInvoice(invoice);
JSONObject obj = JSONObject.parseObject(result);
if (obj.containsKey("code") && obj.getString("code").equals("E0000")) {
invoice.setStatus(obj.getString("status"));//status!=2 开票失败
invoice.setDescription(result);
invoiceService.update(invoice);
rtnJosn.put("errorNo", 0);
rtnJosn.put("errorMsg", "推送成功");
return rtnJosn;
} else if (obj.containsKey("code")) {
invoice.setStatus(obj.getString("status"));//status!=2 开票失败
invoice.setInvoiceContent(obj.getString("failCause"));
invoice.setDescription(result);
invoiceService.update(invoice);
rtnJosn.put("errorNo", 1);
rtnJosn.put("errorMsg", obj.getString("describe"));
return rtnJosn;
}
}
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
rtnJosn.put("errorNo", 1);
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = INVOICE_VIEW)
public void exportExcel(HttpServletRequest request, HttpServletResponse response , Invoice invoice) {
public void exportExcel(HttpServletRequest request, HttpServletResponse response, Invoice invoice) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
if (!StringUtils.isEmpty(invoice.getInvoiceTitle())){
conds.like("t.invoice_title",invoice.getInvoiceTitle());
if (StringUtils.isNoneBlank(invoice.getOrderId())) {
conds.like("t.order_id", invoice.getOrderId());
}
if (StringUtils.isNoneBlank(invoice.getInvoiceTitle())) {
conds.like("t.invoice_title", invoice.getInvoiceTitle());
}
conds.equal("t.del_flag", 0);
conds.equal("t.accounts_id", accountId);
Sort sort = new Sort("t.create_time", OrderType.DESC);
List<Invoice> list = invoiceService.fetchSearchByPage(conds, sort, 0, 0);
if (list.size() > 0){
for (Invoice invoiceObj : list) {
invoiceObj.setInvoiceType(StringUtils.isEmpty(invoiceObj.getInvoiceType()) ? "" : invoiceObj.getInvoiceType().equals("1") ? "企业":"个人" );
invoiceObj.setInvoiceForm(StringUtils.isEmpty(invoiceObj.getInvoiceForm()) ? "" : invoiceObj.getInvoiceForm().equals("0") ? "移动端" : "后台");
invoiceObj.setPushMode(StringUtils.isEmpty(invoiceObj.getPushMode()) ? "" : "邮箱");
//invoiceObj.setStatus(StringUtils.isEmpty(invoiceObj.getStatus()) ? "" : invoiceObj.getStatus().equals("0") ? "个人" :"企业");
for (Invoice obj : list) {
switch (obj.getStatus()) {
case "0":
obj.setStatus("申请成功");
break;
case "2":
obj.setStatus("开票成功");
break;
case "20":
obj.setStatus("开票中");
break;
case "22":
obj.setStatus("开票失败");
break;
default:
obj.setStatus("其他");
}
obj.setInvoiceType(StringUtils.equals(obj.getInvoiceType(), "0") ? "个人" : "企业");
obj.setInvoiceForm(StringUtils.equals(obj.getInvoiceForm(), "0") ? "移动端" : "PC端");
obj.setPushMode(StringUtils.equals(obj.getPushMode(), "0") ? "邮箱" : "");
}
ExcelKit.$Export(Invoice.class, response).toExcel(list, "开票信息信息");
}
......@@ -211,7 +255,6 @@ public class InvoiceController {
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
......
......@@ -72,4 +72,16 @@ public class InvoiceHttpUtil {
log.info("发票查询pdf结果" + result);
return result;
}
public static String resetSendInvoice(Invoice invoice) {
JSONObject params = new JSONObject();
params.put("fpqqlsh", invoice.getInvoiceSerialNum());//发票流水号
params.put("orderno", invoice.getOrderId());//订单编码
String method = SystemConfig.p.getProperty("INVOICE_RESET_API");
NNOpenSDK sdk = NNOpenSDK.getIntance();
String result = sdk.sendPostSyncRequest(url, genarateUUID(), appKey, appSecret, token, taxNum, method, params.toString());
log.info("发票重推结果:{}", result.toString());
return result;
}
}
......@@ -193,7 +193,7 @@
class="form-control" name="sendExpressDate"
id="sendExpressDate" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.sendExpressDate}"
value="$!{data.sendExpressDateStr}"
>
</div>
......@@ -203,7 +203,7 @@
class="form-control" name="acceptExpressDate"
id="acceptExpressDate" readonly="readonly"
maxlength="50" placeholder=""
value="$!{data.acceptExpressDate}"
value="$!{data.acceptExpressDateStr}"
>
</div>
......@@ -473,27 +473,28 @@
}
function getPrice(e) {
let price = $(e).find("option:selected").attr('data-price');
$(e).parent().find('input[name="htmlPrice"]').val(price);
let value = $(e).parent().find('input[name="htmlPrice"]').val()
let count = $(e).parent().find('input[name="listHtml"]').val()
let val = value * count;
$(e).parent().find('input[name="htmlAmount"]').val(val);
let value = $(e).find("option:selected").attr('data-price');
$(e).parent().find('input[name="htmlPrice"]').val(value);
let price = $(e).parent().find('input[name="htmlPrice"]').val();
let count = $(e).parent().find('input[name="listHtml"]').val();
let amount = (Number(price) * 100) * (Number(count) * 100) / 10000;
$(e).parent().find('input[name="htmlAmount"]').val(amount.toFixed(2));
toTal();
}
function updateCount(value) {
var price = $(value).parent().find('input[name="htmlPrice"]').val();
var count = $(value).val();
var totalPrice = price * count;
$(value).parent().find('input[name="htmlAmount"]').val(totalPrice.toFixed(2))
let price = $(value).parent().find('input[name="htmlPrice"]').val();
let count = $(value).val();
let amount = (Number(price) * 100) * (Number(count) * 100) / 10000;
$(value).parent().find('input[name="htmlAmount"]').val(amount.toFixed(2))
toTal();
}
function updatePrice(value) {
var price = $(value).val();
var number = $(value).parent().find('input[name="listHtml"]').val();
var amount = (price * number).toFixed(2);
$(value).parent().find('input[name="htmlAmount"]').val(amount);
let price = $(value).val();
let count = $(value).parent().find('input[name="listHtml"]').val();
let amount = (Number(price) * 100) * (Number(count) * 100) / 10000;
$(value).parent().find('input[name="htmlAmount"]').val(amount.toFixed(2));
toTal();
}
......@@ -510,7 +511,7 @@
function toTal() {
var amount = 0;
$('.translate [name="htmlAmount"]').each(function (index, item) {
amount += +item.value
amount += +item.value;
})
$("#orderAmount").val(amount.toFixed(2));
}
......
......@@ -455,11 +455,10 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
conds.equal("o.id", invoiceDto.getId());
conds.equal("o.del_flag", Constants.DEL_FLAG_0);
List<Order> list = this.fetchSearchBy(conds, null, 0, 0, null, null, null);
if (list.size() > 0) {
if (list != null && list.size() > 0) {
for (Order order : list) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
order.setCreateTimeStr(format.format(order.getCreateTime()));
String str = invoiceUtil.startInvoice(order, invoiceDto.getEmail(), invoiceDto.getType(), invoiceDto.getUnitTaxNumber(), invoiceDto.getInvoiceTitle());
JSONObject json = JSON.parseObject(str);
if (StringUtils.isNotBlank(json.getString("code")) && json.getString("code").equals("E0000")) {
......@@ -467,15 +466,13 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
//流水号
String invoiceSerialNum = json.getJSONObject("result").getString("invoiceSerialNum");
Invoice invoice = new Invoice();
//发票抬头
//发票抬头 抬头类型为公司则发票税号
if (invoiceDto.getType().equals("1")) {
//抬头类型为公司则发票税号
invoice.setUnitTaxNumber(invoiceDto.getUnitTaxNumber());
invoice.setStatus("1");
}
invoice.setAccountsId(mpAccountsEntity.getId());
invoice.setNumber(codingruleUtils.getNumber(mpAccountsEntity.getId(), Invoice.class.getName()));
invoice.setInvoiceTitle(invoiceDto.getInvoiceTitle());
invoice.setInvoiceContent(invoiceDto.getInvoiceContent());
invoice.setInvoiceType(invoiceDto.getType());
invoice.setInvoiceForm("0");
invoice.setClerkId(order.getOpenid());
......@@ -483,7 +480,6 @@ public class OrderServiceImpl extends GenericServiceImpl<Order> implements Order
invoice.setPushMode("0");
invoice.setEmail(invoiceDto.getEmail());
invoice.setInvoiceSerialNum(invoiceSerialNum);
invoice.setAccountsId(mpAccountsEntity.getId());
invoice.setOpenId(order.getOpenid());
invoice.setOperator(order.getNickName());
invoiceService.save(invoice);
......
......@@ -247,11 +247,14 @@ public class OrderController {
Long accountsId = UserUtils.getmpaccounts(request);
MpAccountsEntity mpAccountsEntity = accountsService.getDetail(accountsId);
List<UserRole> roleList = roleService.selectRolesByUserAccountsId(user.getId(), accountsId);
for (UserRole role : roleList) {
if (role.getRoleId() == 5L) {
userid = 1L;
boolean leader = roleService.selectRoleEntityByUserId(userid, Constants.SYSTEM_LEADER);
if (leader) {
userid = 1L;//药店主管
}
boolean manager = roleService.selectRoleEntityByUserId(userid, Constants.SYSTEM_STORAGEMANAGER);
if (manager) {
userid = 1L;//仓管员
}
Conds conds = new Conds();
......@@ -347,7 +350,7 @@ public class OrderController {
conds.equal("o.del_flag", Constants.DEL_FLAG_0);
conds.equal("o.accounts_id", accountsId);
List<Order> list = orderService.fetchSearchBy(conds, null, 0, 0, userid, null, null);
if (list.size() > 0) {
if (list != null && list.size() > 0) {
for (Order order : list) {
//订单为0无法开票
if (new BigDecimal(0).compareTo(new BigDecimal(order.getOrderAmount())) == 0) {
......@@ -364,17 +367,16 @@ public class OrderController {
String invoiceSerialNum = json.getJSONObject("result").getString("invoiceSerialNum");
Invoice invoice = new Invoice();
//发票抬头
invoice.setAccountsId(accountsId);
invoice.setNumber(codingruleUtils.getNumber(accountsId, Invoice.class.getName()));
invoice.setInvoiceTitle("个人");
invoice.setInvoiceContent("商品费用");
invoice.setInvoiceType("0");
invoice.setInvoiceForm("1");
invoice.setClerkId(String.valueOf(UserUtils.getUser().getUsername()));
invoice.setInvoiceType("0");//个人
invoice.setInvoiceForm("1");//PC端
invoice.setClerkId(String.valueOf(UserUtils.getUser().getId()));
invoice.setOrderId(String.valueOf(order.getNumber()));
invoice.setPushMode("0");
invoice.setEmail(email);
invoice.setInvoiceSerialNum(invoiceSerialNum);
invoice.setAccountsId(accountsId);
invoice.setOpenId(order.getOpenid());
String userName = userService.fetchAuthById(userid).getWxUserName();
invoice.setOperator(StringUtils.isEmpty(userName) ? "admin" : userName);
......@@ -388,11 +390,9 @@ public class OrderController {
jsonObject.put("errorMsg", StringUtils.isEmpty(json.getString("describe")) ? json.getString("message") : json.getString("describe"));
return jsonObject;
}
}
jsonObject.put("errorNo", 0);
}
} catch (Exception e) {
jsonObject.put("errorNo", 1);
}
......@@ -422,11 +422,14 @@ public class OrderController {
Long accountsId = UserUtils.getmpaccounts(request);
MpAccountsEntity mpAccountsEntity = accountsService.getDetail(accountsId);
List<UserRole> roleList = roleService.selectRolesByUserAccountsId(user.getId(), accountsId);
for (UserRole role : roleList) {
if (role.getRoleId() == 5L) {
userid = 1L;
boolean leader = roleService.selectRoleEntityByUserId(userid, Constants.SYSTEM_LEADER);
if (leader) {
userid = 1L;//药店主管
}
boolean manager = roleService.selectRoleEntityByUserId(userid, Constants.SYSTEM_STORAGEMANAGER);
if (manager) {
userid = 1L;//仓管员
}
......
......@@ -9,54 +9,58 @@ import java.util.List;
import java.util.Map;
/**
* 产品分类Mapper
*
* @author Buyj
* @date: 2020-09-22 18:06
*/
* 产品分类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);
/**
*
* @return
* @Description 商品列表展示
* @Date 15:19 2020/10/21
* @Param
* @return
**/
List<ProductclassifyVO> productList(ProductclassifyDto productclassifyDto);
/**
*
* @return
* @Description 商品分类菜单数据回填
* @Date 15:19 2020/10/21
* @Param
* @return
**/
List<ProductMenuVO> productMenu();
/**
* @return com.alibaba.fastjson.JSONObject
* @Author Licc
* @Description 热门推荐
* @Date 19:41 2020/11/2
* @Param [appId]
* @return com.alibaba.fastjson.JSONObject
**/
List<ProductVO> hotproduct();
/**
* @return com.alibaba.fastjson.JSONObject
* @Author Licc
* @Description 好药推荐
* @Date 19:42 2020/11/2
* @Param [appId]
* @return com.alibaba.fastjson.JSONObject
**/
List<ProductVO> medicine();
/**
* 根据分类编码查分类ID
*
* @param classifyNumber
* @return
*/
......
......@@ -227,7 +227,8 @@
t.size AS size,
t.isreading AS isreading,
t.reading AS reading,
c.classify_name AS classifyName
c.classify_name AS classifyName,
t.price AS price
FROM t_aidea_product t LEFT JOIN t_aidea_product_classify c
ON find_in_set(c.id,t.classify_id) > 0 WHERE t.del_flag = 0 and c.del_flag = 0
<if test="productName !=null and productName!=''">
......
......@@ -15,4 +15,5 @@ public class ProductclassifyDto {
private String appId;
private Long page;
private Long pageSize;
private String price;
}
......@@ -2,6 +2,8 @@ package com.cftech.productclassify.model;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author :licc
* @date :Created in 2020/10/21 17:49
......@@ -29,4 +31,5 @@ public class ProductclassifyVO {
private Long size;
private Long isreading;
private Long reading;
private Double price;
}
......@@ -35,6 +35,7 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
private ProductclassifyMapper productclassifyMapper;
@Autowired
private MpAccountsService mpAccountsService;
@Override
public GenericDao<Productclassify> getGenericMapper() {
return productclassifyMapper;
......@@ -65,18 +66,18 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
// dosagaFrom = null;
// }
List<ProductclassifyVO> productVOS = productclassifyMapper.productList(productclassifyDto);
if (productVOS==null){
rtnJson.put("errorNo","1");
rtnJson.put("errorNo","查询失败");
if (productVOS == null) {
rtnJson.put("errorNo", "1");
rtnJson.put("errorNo", "查询失败");
return rtnJson;
}
Log.info("返回结果:"+productVOS);
rtnJson.put("errorNo","0");
rtnJson.put("data",productVOS);
Log.info("返回结果:" + productVOS);
rtnJson.put("errorNo", "0");
rtnJson.put("data", productVOS);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
rtnJson.put("errorNo","1");
rtnJson.put("errorNo", "1");
}
......@@ -90,18 +91,18 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<ProductMenuVO> menu = productclassifyMapper.productMenu();
if (menu==null){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","查询失败");
if (menu == null) {
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "查询失败");
return rtnJson;
}
Log.info("返回结果:"+menu);
rtnJson.put("errorNo","0");
rtnJson.put("data",menu);
Log.info("返回结果:" + menu);
rtnJson.put("errorNo", "0");
rtnJson.put("data", menu);
}catch (Exception e){
} catch (Exception e) {
e.printStackTrace();
rtnJson.put("errorNo","1");
rtnJson.put("errorNo", "1");
}
return rtnJson;
}
......@@ -112,17 +113,17 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<ProductVO> hotproduct = productclassifyMapper.hotproduct();
if (hotproduct==null){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","查询失败");
if (hotproduct == null) {
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "查询失败");
return rtnJson;
}
Log.info("返回结果:"+hotproduct);
rtnJson.put("errorNo","0");
rtnJson.put("data",hotproduct);
}catch (Exception e){
Log.info("返回结果:" + hotproduct);
rtnJson.put("errorNo", "0");
rtnJson.put("data", hotproduct);
} catch (Exception e) {
e.printStackTrace();
rtnJson.put("errorNo","1");
rtnJson.put("errorNo", "1");
}
return rtnJson;
......@@ -134,17 +135,17 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<ProductVO> medicine = productclassifyMapper.medicine();
if (medicine==null){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","查询失败");
if (medicine == null) {
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "查询失败");
return rtnJson;
}
Log.info("返回结果:"+medicine);
rtnJson.put("errorNo","0");
rtnJson.put("data",medicine);
}catch (Exception e){
Log.info("返回结果:" + medicine);
rtnJson.put("errorNo", "0");
rtnJson.put("data", medicine);
} catch (Exception e) {
e.printStackTrace();
rtnJson.put("errorNo","1");
rtnJson.put("errorNo", "1");
}
return rtnJson;
......@@ -162,17 +163,17 @@ public class ProductclassifyServiceImpl extends GenericServiceImpl<Productclassi
try {
MpAccountsEntity mpAccountsAppid = mpAccountsService.getMpAccountsAppid(appId);
List<ProductVO> productVOS = productclassifyMapper.productDosage();
if (productVOS==null){
rtnJson.put("errorNo","1");
rtnJson.put("errorMsg","查询失败");
if (productVOS == null) {
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "查询失败");
return rtnJson;
}
Log.info("返回结果:"+productVOS);
rtnJson.put("errorNo","0");
rtnJson.put("data",productVOS);
}catch (Exception e){
Log.info("返回结果:" + productVOS);
rtnJson.put("errorNo", "0");
rtnJson.put("data", productVOS);
} catch (Exception e) {
e.printStackTrace();
rtnJson.put("errorNo","1");
rtnJson.put("errorNo", "1");
}
return rtnJson;
......
......@@ -19,59 +19,64 @@ import org.springframework.web.bind.annotation.*;
public class MobileclassifyController {
@Autowired
private com.cftech.productclassify.service.ProductclassifyService ProductclassifyService;
/**
* @return
* @Author Licc
* @Description 商品列表展示
* @Date 14:14 2020/10/21
* @Param
* @return
**/
@RequestMapping(value = "/productList",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productList(ProductclassifyDto productclassifyDto){
@RequestMapping(value = "/productList", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productList(ProductclassifyDto productclassifyDto) {
return ProductclassifyService.productList(productclassifyDto);
}
/**
* @return com.alibaba.fastjson.JSONObject
* @Author Licc
* @Description 商品分类菜单数据回填
* @Date 9:46 2020/10/22
* @Param []
* @return com.alibaba.fastjson.JSONObject
**/
@RequestMapping(value = "/productMenu",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productMenu(String appId){
@RequestMapping(value = "/productMenu", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productMenu(String appId) {
return ProductclassifyService.productMenu(appId);
}
/**
* @return com.alibaba.fastjson.JSONObject
* @Author Licc
* @Description 商品分类菜单剂型回填
* @Date 9:46 2020/10/22
* @Param []
* @return com.alibaba.fastjson.JSONObject
**/
@RequestMapping(value = "/productDosage",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productDosage(String appId,String dosageName){
return ProductclassifyService.productDosage(appId,dosageName);
@RequestMapping(value = "/productDosage", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject productDosage(String appId, String dosageName) {
return ProductclassifyService.productDosage(appId, dosageName);
}
/**
* @return
* @Author Licc
* @Description 热门推荐
* @Date 19:40 2020/11/2
* @Param
* @return
**/
@RequestMapping(value = "/hotproduct",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject hotproduct(String appId){
@RequestMapping(value = "/hotproduct", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject hotproduct(String appId) {
return ProductclassifyService.hotproduct(appId);
}
/**
* @return
* @Author Licc
* @Description 好药推荐
* @Date 19:40 2020/11/2
* @Param
* @return
**/
@RequestMapping(value = "/medicine",method = {RequestMethod.GET,RequestMethod.POST},produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject medicine(String appId){
@RequestMapping(value = "/medicine", method = {RequestMethod.GET, RequestMethod.POST}, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject medicine(String appId) {
return ProductclassifyService.medicine(appId);
}
......
......@@ -97,10 +97,10 @@
</div>
<div class="form-group form-md-line-input col-md-12">
<label>品名称</label>
<label>品名称</label>
<input type="text" required class="form-control pull-right"
value="$!{data.productName}" maxlength="500" required
name="productName" placeholder="品名称"
name="productName" placeholder="品名称"
>
</div>
......@@ -113,10 +113,10 @@
</div>
<div class="form-group form-md-line-input col-md-12">
<label>通用名</label>
<label>通用名</label>
<input type="text" required class="form-control pull-right"
value="$!{data.commonName}" maxlength="500" required
name="commonName" placeholder="通用名"
name="commonName" placeholder="通用名"
>
</div>
......@@ -153,10 +153,10 @@
</div>
<div class="form-group form-md-line-input col-md-12">
<label>推荐计</label>
<label>用法用</label>
<input type="text" required class="form-control pull-right"
value="$!{data.recommendMeasure}" maxlength="500" required
name="recommendMeasure" placeholder="推荐计量"
name="recommendMeasure" placeholder="用法用量"
>
</div>
......
......@@ -174,7 +174,7 @@ public class ExpressOrderInfoUtils {
//特殊需求药品,需冷冻、冷藏
if (StringUtils.isNoneBlank(waybillObj.getExpressTypeId())) {
waybill.put("expressTypeId", waybillObj.getExpressTypeId());//快件产品类别Id 12医药类 冷冻 冷藏
waybill.put("expressTypeId", "1");//快件产品类别Id 1:特快 12医药类 冷冻 冷藏
//waybill.put("temperatureRange", waybillObj.getTemperatureRange());//1:冷藏 3:冷冻
}
......
......@@ -95,7 +95,7 @@ sf.monthlyCard=7551234567
#\u8BFA\u8BFA\u5F00\u7968\u914D\u7F6E\u4FE1\u606F\u53C2\u6570
INVOICE_URL=https://sandbox.nuonuocs.cn/open/v1/services
INVOICE_TOKEN=4d02142a23eece11a0407f0sghefntms
SQ_INVOICE_TAX=91321000MA22HQQ953
#SQ_INVOICE_TAX=91321000MA22HQQ953
INVOICE_TAX=339901999999824
SALER_TEL=0514-82360278
SALER_ADDRESS=\u626C\u5DDE\u5E02\u9097\u6C5F\u533A\u79D1\u6280\u56ED\u8DEF18\u53F7
......@@ -113,6 +113,8 @@ INVOICE_QUERY_API=nuonuo.ElectronInvoice.queryInvoiceResult
INVOICE_SEND_EMAIL_API=nuonuo.ElectronInvoice.deliveryInvoice
#\u83B7\u53D6\u53D1\u7968PDF\u63A5\u53E3
INVOICE_OPEN_PDF_API=nuonuo.ElectronInvoice.getPDF
#\u91CD\u5F00\u53D1\u7968\u63A5\u53E3
INVOICE_RESET_API=nuonuo.ElectronInvoice.reInvoice
REGION_LONG_ID=0,1,5,
......
......@@ -83,7 +83,7 @@ jwt.duration=86400000
#\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\uFFFD\u03AAtrue
security.secure=false
#\u662F\u5426\u96C6\u7FA4 master\u4E3Atrue
quartz.isCluster=true
quartz.isCluster=false
#\u987A\u4E30\u7269\u6D41\u914D\u7F6E\u4FE1\u606F\u53C2\u6570
#\u987A\u4E30\u5BA2\u6237\u7F16\u7801
......@@ -114,6 +114,8 @@ INVOICE_QUERY_API=nuonuo.ElectronInvoice.queryInvoiceResult
INVOICE_SEND_EMAIL_API=nuonuo.ElectronInvoice.deliveryInvoice
#\u83B7\u53D6\u53D1\u7968PDF\u63A5\u53E3
INVOICE_OPEN_PDF_API=nuonuo.ElectronInvoice.getPDF
#\u91CD\u5F00\u53D1\u7968\u63A5\u53E3
INVOICE_RESET_API=nuonuo.ElectronInvoice.reInvoice
REGION_LONG_ID=0,1,2,
......
......@@ -12,6 +12,12 @@ public class Constants {
*/
public static final String VALUE_SESSION_KEY="sysUser";
/**
* 药店主管角色标识
*/
public static final String SYSTEM_LEADER = "sys:leader";
public static final String SYSTEM_STORAGEMANAGER= "sys:storageManager";
/*
* 删除状态(未删除)
......@@ -22,6 +28,10 @@ public class Constants {
*/
public static final String DEL_FLAG_1 = "1";
public static final String TRUE = "1";
public static final String FALSE = "0";
/*
* 会员编号
*/
......
<!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">
<link rel="stylesheet" href="plugins/select2/select2.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>
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="exampleModalLabel" style="font-weight: 700;">拒绝原由</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>
<div class="form-group">
<label for="message-text" class="col-form-label">请输入拒绝原由:</label>
<input id="memberId" name="memberId" style="display: none;">
<textarea class="form-control" rows="3" id="js-textarea"></textarea>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" onclick="refuseAudit()">提交</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="tabsDiv" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" style="font-weight: 700;">设置患者类型</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<form>
<input id="tabNumberId" name="tabNumberId" style="display: none;">
<div class="form-group">
<!-- <label for="message-text" class="col-form-label">请选择患者类型:</label>-->
<select class="form-control select2" style="width: 100%" multiple="multiple" data-placeholder="请选择类型">
#foreach($group in $groups)
<option value="${group.id}" data-attr="${role.roleSign}">${group.name}
</option>
#end
</select>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" onclick="submitTabs()">提交</button>
</div>
</div>
</div>
</div>
<!-- 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/member/exportExcel')" method="get"
onkeydown="if(event.keyCode==13){return false;}">
<div class="col-xs-2">
<input type="text" class="form-control required"
name="phone" placeholder="手机号">
</div>
<div class="col-xs-2">
<input type="text" class="form-control required"
name="name" placeholder="会员名称">
</div>
<div class="col-xs-5">
<a href="javascript:void(0)" class="btn btn-primary search">搜索</a>
#if($shiro.hasPermission("qy:member:edit"))
#end
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td>
<th>头像</th>
<th>性别</th>
<th>微信OPENID</th>
<th>姓名</th>
<th>联系方式</th>
<th>随机码</th>
<th>身份证</th>
<th>审核状态</th>
<th>来源</th>
<th>患者类型</th>
<th>创建日期</th>
<th>操作</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="plugins/select2/select2.full.min.js"></script>
<script>
var csrfheader = {name: '_csrf_header', value: '${_csrf.headerName}'};
var csrftoken = {name: '_csrf', value: '${_csrf.token}'};
</script>
<script src="common/js/tabletok.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
function formatDates(now) {
var date = new Date(now);
var y = date.getFullYear();
var m = date.getMonth() + 1;
m = m < 10 ? ('0' + m) : m;
var d = date.getDate();
d = d < 10 ? ('0' + d) : d;
var h = date.getHours();
h = h < 10 ? ('0' + h) : h;
var minute = date.getMinutes();
var second = date.getSeconds();
minute = minute < 10 ? ('0' + minute) : minute;
second = second < 10 ? ('0' + second) : second;
return y + '-' + m + '-' + d + ' ' + h + ':' + minute + ':' + second;
}
function seachTable() {
var sSource = "#springUrl('/a/member/listAuditData')";
var aoData = {
iDisplayStart: 0,
iDosplayLength: 10,
csrf_header: csrfheader,
csrf_token: csrftoken
}
$('#table').DataTable({
"lengthChange": false,
"searching": false,
"ordering": false,
"bFiltered": false,
"bStateSave": false, // save datatable state(pagination, sort, etc) in cookie.
"bProcessing": true,
"bServerSide": true,
"sAjaxSource": sSource,
"fnServerData": retrieveData,
"pagingType": "full_numbers",
"aoColumns": [
{
"mData": "id"
},
{
"mData": "imageurl"
},
{
"mData": "sex"
},
{
"mData": "openId"
},
{
"mData": "name"
},
{
"mData": "phone"
},
{
"mData": "invitcode"
},
{
"mData": "cardid"
},
{
"mData": "status"
},
{
"mData": "source"
},
{
"mData": "memberId"
},
{
"mData": "createTime"
},
{
"mData": "id"
}
],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets": [1],
"mData": "imageurl",
"mRender": function (a, b, c, d) {
return '<img src="' + a + '" style="width:80px;height:80px;">';
}
}, {
"aTargets": [2],
"mData": "sex",
"mRender": function (a, b, c, d) {
if (a == 2) {
return '女'
} else if (a == 1) {
return '男';
} else {
return '';
}
}
},
{
"aTargets": [3],
"mData": "openId",
"mRender": function (a, b, c, d) {
return a;
}
}, {
"aTargets": [4],
"mData": "name",
"mRender": function (a, b, c, d) {
if (a == '' || a == null) {
return '';
}
return a.slice(0, 1) + '*' + a.slice(2, a.length);
}
}, {
"aTargets": [5],
"mData": "phone",
"mRender": function (a, b, c, d) {
if (a == '' || a == null) {
return '';
}
return a.slice(0, 3) + '****' + a.slice(7);
}
},
{
"aTargets": [8],
"mData": "status",
"mRender": function (a, b, c, d) {
if (a == 0) {
return "待审核";
} else if (a == 1) {
return "已通过";
} else if (a == 2) {
return "已拒绝";
}
return '';
}
},
{
"aTargets": [9],
"mData": "source",
"mRender": function (a, b, c, d) {
if (a == 1) {
return "普通关注";
} else if (a == 2) {
return "药师二维码";
} else if (a == 3) {
return "客服二维码";
} else if (a == 4) {
return "医生二维码";
} else if (a == 5) {
return "组织二维码";
} else {
return "用户注册";
}
}
},
{
"aTargets": [9],
"mData": "memberId",
"mRender": function (a, b, c, d) {
return a;
}
}
, {
"aTargets": [11],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return formatDates(a, "yyyy-MM-dd HH:mm:ss");
}
},
{
"aTargets": [12],
"mData": "id",
"mRender": function (a, b, c, d) {
var html = '';
html += '#if($shiro.hasPermission("qy:member:audit"))';
html += '<a onclick="showTabsDiv('+c.id+')" class="btn green">设置类型</a>';
if (c.status == '0') {
html += '<a onclick="auditPass(' + c.id + ')" class="btn green">审核通过</a>';
}
if (c.status != '2') {
html += '<a onclick="auditNotPass(' + c.id + ')" class="btn green">审核拒绝</a>';
}
html += '#end';
return html;
}
}
]
});
}
jQuery(document).ready(function () {
$(".select2").select2();
seachTable();
$('.datepicker').datepicker({
show: true,
format: 'yyyy-mm-dd',
autoclose: true,
language: 'zh-CN',
todayBtn: 'linked',
clearBtn: 'linked'
});
$('.search').click(function () {
$("#table").dataTable().fnClearTable();
});
$("#tagCacel").click(function () {
$("#addlabelModal").modal("hide");
})
});
Cfapp.init();
function auditPass(id) {
audit(id, "1");
}
function auditNotPass(id) {
audit(id, "2");
}
function audit(data, status) {
Cfapp.confirm({
message: "确定要" + (status == "1" ? "通过" : "拒绝") + "吗?",
btnoktext: "确定",
btncanceltext: "取消",
success: function () {
if (status == '1') {
postAudit(data, status, null);
} else {
$('#memberId').val(data);
$('#exampleModal').modal('show');
}
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function refuseAudit() {
postAudit($("#memberId").val(), "2", $("#js-textarea").val());
}
function postAudit(id, status, remarks) {
$.ajax({
type: "POST",
url: "#springUrl('/a/member/audit')",
data: {id: id, status: status, remarks: remarks, _csrf_header: csrfheader.value, _csrf: csrftoken.value},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
// csrfheader.value = resp._csrf_header;
// csrftoken.value = resp._csrf;
Cfapp.alert({
message: "审批成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/member/listaudit')";
}
});
}
},
error: function () {
}
})
}
function showTabsDiv(id) {
$("#tabsDiv").modal('show');
$("#tabNumberId").val(id);
$.ajax({
type: "POST",
url: "#springUrl('/a/member/memberById')",
data: {id: $("#tabNumberId").val(), _csrf_header: csrfheader.value, _csrf: csrftoken.value},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
if (data.member.memberId != null) {
$(".select2").val(data.member.memberId.split(",")).trigger("change");
} else {
$(".select2").val([]).trigger("change");
}
}
},
error: function () {
}
});
//$(".select2").val([]).trigger("change");
}
function submitTabs() {
debugger;
$("#tabsDiv").modal('hide');
let vals = $('.select2').select2('val');
if (vals.length == 0) {
Cfapp.alert({ message: "请先选择患者类型", btntext: "确定", success: function () {} });
return;
}
$.ajax({
type: "POST",
url: "#springUrl('/a/member/formData')",
data: {id: $("#tabNumberId").val(), memberId: vals.join(','), _csrf_header: csrfheader.value, _csrf: csrftoken.value},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
$("#tabsDiv").modal('hide');
location.href = "#springUrl('/a/member/listaudit')";
}
},
error: function () {
}
});
}
</script>
</body>
</html>
......@@ -136,6 +136,7 @@
<th>联系方式</th>
<th>身份证</th>
<th>来源</th>
<th>三期患者</th>
<!-- <th>邀请码</th>-->
<!-- <th>客户分类</th>-->
<!-- <th>名片</th>-->
......@@ -250,6 +251,9 @@
{
"mData": "source"
},
{
"mData": "status"
},
{
"mData": "createTime"
}
......@@ -322,8 +326,18 @@
return "用户注册";
}
}
},
{
"aTargets": [8],
"mData": "status",
"mRender": function (a, b, c, d) {
if (a == 1) {
return "三期";
}
, {
return '';
}
},
{
"aTargets": [8],
"mData": "createTime",
"mRender": function (a, b, c, d) {
......@@ -373,6 +387,7 @@
}
})
}
function addMemer() {
$("#addlabelModal").modal("show");
}
......@@ -402,6 +417,7 @@
});
Cfapp.init();
function removeData(data) {
Cfapp.confirm({
message: "确定要删除吗",
......
<!DOCTYPE html>
<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html>
<!--<![endif]-->
<!-- BEGIN HEAD -->
<head>
<base href="#springUrl('/assets/adminlte/')"/>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>工作台</title>
<!-- Tell the browser to be responsive to screen width -->
<meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
<!-- Bootstrap 3.3.5 -->
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<!-- Font Awesome -->
<link rel="stylesheet" href="plugins/font-awesome/css/font-awesome.min.css">
<!-- Ionicons -->
<link rel="stylesheet" href="plugins/ionicons/css/ionicons.min.css">
<!-- DataTables -->
<link rel="stylesheet" href="plugins/datatables/dataTables.bootstrap.css">
<!-- Theme style -->
<link rel="stylesheet" href="dist/css/AdminLTE.min.css">
<!-- AdminLTE Skins. Choose a skin from the css/skins
folder instead of downloading all of them to reduce the load. -->
<link rel="stylesheet" href="dist/css/skins/_all-skins.min.css">
<!-- iCheck -->
<link rel="stylesheet" href="plugins/iCheck/flat/blue.css">
<!-- Date Picker -->
<link rel="stylesheet" href="plugins/datepicker/datepicker3.css">
<!-- Daterange picker -->
<link rel="stylesheet" href="plugins/daterangepicker/daterangepicker-bs3.css">
<!-- bootstrap wysihtml5 - text editor -->
<link rel="stylesheet" href="plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
<!--validate css-->
<link rel="stylesheet" href="plugins/jquery-validation/css/validate.css">
<!--fileinput css-->
<link rel="stylesheet" href="plugins/bootstrap-fileinput/bootstrap-fileinput.css">
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<!-- END HEAD -->
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
<div class="content-wrapper" style="margin-left:0;">
<section class="content-header">
<h1>
患者类型管理
<small>患者类型</small>
</h1>
<ol class="breadcrumb">
<li><a href="#"><i class="fa fa-dashboard"></i>首页</a></li>
<li><a class="active">患者类型</a></li>
</ol>
</section>
<!-- Main content -->
<section class="content">
<div class="row">
<div class="col-xs-12">
<!-- general form elements disabled -->
<div class="box box-primary">
<form role="form" id="myForm">
<input name="id" value="$!{data.id}" hidden="true"/>
<div class="box-body">
<div class="form-group form-md-line-input">
<label>类型名称</label>
<input type="text"
class="form-control" name="name"
id="name"
placeholder="类型名称"
value="$!{data.name}"
required="required"
>
</div>
<div class="form-group form-md-line-input">
<label>备注</label>
<textarea type="text" required class="form-control pull-right"
value="" maxlength="255" required rows="3"
name="description" placeholder="备注"
>$!{data.description}</textarea>
</div>
</div>
<div class="box-footer">
#if($shiro.hasPermission("qy:memberGroup:edit"))
<input class="btn btn-primary" id="save" value="保存" type="submit">
#end
<a href="#springUrl('/a/memberGroup/list')" class="btn btn-default">取消</a>
</div>
</form>
<!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins/bootstrap-fileinput/bootstrap-fileinput.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script src="plugins/bootstrap-maxlength/bootstrap-maxlength.min.js" type="text/javascript"></script>
<script src="plugins/security/sha256.js" type="text/javascript"></script>
<script src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<script src="js/jquery.form.min.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.config.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/ueditor.all.js"></script>
<script type="text/javascript" charset="utf-8" src="plugins/ueditor-min-1.4.3/lang/zh-cn/zh-cn.js"></script>
<script src="common/js/cfapp.js"></script>
<!-- END PAGE LEVEL PLUGINS -->
<script>
$().ready(function () {
Cfapp.init();
recdTypeAdd.init();
});
var recdTypeAdd = function () {
var initForm = function () {
var initFormCtrl = function () {
bindEvent();
};
var bindEvent = function () {
$("#myForm").validate({
rules: {},
messages: {},
submitHandler: function (form) {
$("#save").attr("disabled", true);
$.getJSON("#springUrl('/a/memberGroup/formData')", $("#myForm").serialize(), function (returnobj) {
$("#save").attr("disabled", false);
if (returnobj.errorNo == 2) { //保存成功
Cfapp.confirm({
message: "添加成功",
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/memberGroup/form')";
},
cancel: function () {
location.href = "#springUrl('/a/memberGroup/list')";
}
});
} else if (returnobj.errorNo == 0) { //修改成功
Cfapp.alert({
message: "更新成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/memberGroup/list')";
}
});
} else {
Cfapp.alert({
message: "创建失败",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/memberGroup/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/memberGroup/list')" method="get">
<div class="col-xs-5">
<div class="col-xs-4">
<input type="text" class="form-control required"
name="name" placeholder="类型名称">
</div>
<button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:memberGroup:edit"))
<a href="#springUrl('/a/memberGroup/form')" class="btn btn-primary">新增</a>
<!-- <a href="#springUrl('/a/memberGroup/exportExcel')" class="btn btn-primary">导出</a>-->
<!-- <a onclick="importExcel();" class="btn btn-primary">导入</a>-->
#end
</div>
</form>
</div><!-- /.box-header -->
<div class="box-body">
<table id="table" class="table table-bordered table-striped">
<thead>
<tr>
<td hidden="true">Id</td>
<th>编码</th>
<th>类型名称</th>
<th>备注</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody id="tablebody">
</tbody>
</table>
</div><!-- /.box-body -->
</div><!-- /.box -->
</div><!-- /.col -->
</div><!-- /.row -->
</section><!-- /.content -->
</div><!-- /.content-wrapper -->
<!-- Add the sidebar's background. This div must be placed
immediately after the control sidebar -->
<div class="control-sidebar-bg"></div>
</div><!-- ./wrapper -->
<!-- jQuery 2.1.4 -->
<script src="plugins/jQuery/jQuery-2.1.4.min.js"></script>
<!-- Bootstrap 3.3.5 -->
<script src="bootstrap/js/bootstrap.min.js"></script>
<!-- DataTables -->
<script src="plugins/datatables/jquery.dataTables.min.js"></script>
<script src="plugins/datatables/extensions/i18n/lanauage_ch.js"></script>
<script src="plugins/datatables/dataTables.bootstrap.min.js"></script>
<!-- SlimScroll -->
<script src="plugins/slimScroll/jquery.slimscroll.min.js"></script>
<script src="plugins/datepicker/bootstrap-datepicker.js"></script>
<script src="plugins/datepicker/locales/bootstrap-datepicker.zh-CN.js"></script>
<!-- FastClick -->
<script src="plugins/fastclick/fastclick.min.js"></script>
<!--fileinput js-->
<script src="plugins\bootstrap-fileinput\fileinput.js"></script>
<script src="plugins/bootstrap-fileinput/zh.js"></script>
<script src="plugins/bootstrap-fileinput/zh2.js"></script>
<!-- AdminLTE App -->
<script src="dist/js/app.min.js"></script>
<script type="text/javascript"
src="plugins/jquery-validation/js/jquery.validate.min.js"></script>
<!-- AdminLTE for demo purposes -->
<script src="common/js/cfapp.js"></script>
<script>
var csrfheader = {name: '_csrf_header', value: '${_csrf.headerName}'};
var csrftoken = {name: '_csrf', value: '${_csrf.token}'};
</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/memberGroup/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": "number"
},
{
"mData": "name"
},
{
"mData": "description"
},
{
"mData": "createTime"
},
{
"mData": "id"
}],
"aoColumnDefs": [
{ // set default column settings
'visible': false,
'targets': [0]
},
{
"aTargets": [4],
"mData": "createTime",
"mRender": function (a, b, c, d) {
return '<a href="#springUrl("/a/memberGroup/form?id=' + c.id + '")" data-id="' + c.id + '" data-action="view">' + formatDates(a, "yyyy-MM-dd HH:mm:ss");
+'</a>';
}
},
{
"aTargets": [5],
"mData": "id",
"mRender": function (a, b, c, d) {//a表示id对应的值,c表示当前记录行对象
var html = '#if($shiro.hasPermission("qy:authentication:edit"))';
html += '<a href="#springUrl("/a/memberGroup/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/memberGroup/delete')",
data: {id: data, _csrfheader: csrfheader.value, _csrf: csrftoken.value},
dataType: "json",
success: function (data) {
if (data.errorNo == 0) {
Cfapp.alert({
message: "删除成功",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/memberGroup/list')";
}
});
}
},
error: function () {
}
})
},
cancel: function () {
$(".modal-backdrop").fadeOut();
}
});
}
function importExcel() {
var templateExcelUrl = "#springUrl('/a/memberGroup/templateExcel')";
var importExcelUrl = "#springUrl('/a/memberGroup/importExcel')";
Cfapp.importExcel({
title: '患者类型导入',
importurl: importExcelUrl,
templateurl: templateExcelUrl,
cancel: function () {
},
success: function () {
}
});
}
</script>
</body>
</html>
......@@ -30,13 +30,13 @@
<result column="invitcode" property="invitcode"/>
<result column="compan" property="compan"/>
<result column="source" property="source"/>
<result column="audit_time" property="auditTime"/>
</resultMap>
<resultMap id="resultMapDto" type="com.cftech.member.model.MemberDto">
<id column="id" property="id"/>
<result column="imageurl" property="imageurl"/>
<result column="sex" property="sex"/>
<result column="surname" property="surname"/>
<result column="name" property="name"/>
<result column="phone" property="phone"/>
<result column="compan" property="compan"/>
......@@ -84,7 +84,7 @@
imageurl,
cardid,
CONVERT(AES_DECRYPT(email,'aideakey') USING UTF8) email,
member_id,
member_id memberId,
accounts_id,
del_flag,
status,
......@@ -103,12 +103,13 @@
doctor_id,
invitcode,
compan,
source
source,
audit_time
</sql>
<sql id="sqlColumns">
id,number,name,phone,imageurl,cardid,email,member_id,accounts_id,del_flag,status,create_time,update_time,description,create_by,update_by,
open_id,storeid,fanss_store_id,sex,birthday,area,service_id,doctor_id,invitcode,compan,source
open_id,storeid,fanss_store_id,sex,birthday,area,service_id,doctor_id,invitcode,compan,source,audit_time
</sql>
<insert id="save" parameterType="com.cftech.member.model.Member" useGeneratedKeys="true"
......@@ -138,12 +139,14 @@
#{openId, jdbcType=VARCHAR},
#{storeid,jdbcType=VARCHAR},
#{fanssStoreId, jdbcType=BIGINT},
#{sex, jdbcType=BIGINT},AES_ENCRYPT(#{birthday,jdbcType=VARBINARY},'aideakey'),#{area,jdbcType=VARCHAR},
#{sex, jdbcType=BIGINT},
AES_ENCRYPT(#{birthday,jdbcType=VARBINARY},'aideakey'),#{area,jdbcType=VARCHAR},
#{serviceId, jdbcType=VARCHAR},
#{doctorId,jdbcType=VARCHAR},
#{invitcode,jdbcType=VARCHAR},
#{compan,jdbcType=VARCHAR},
#{source,jdbcType=BIGINT}
#{source,jdbcType=BIGINT},
#{auditTime,jdbcType=TIMESTAMP}
)
</insert>
......@@ -152,10 +155,10 @@
t.id,
t.number,
t.name,
CONVERT( AES_DECRYPT( t.phone,'aideakey') USING UTF8) t.phone,
CONVERT( AES_DECRYPT( t.phone,'aideakey') USING UTF8) phone,
t.imageurl,
t.cardid,
CONVERT( AES_DECRYPT(t.email,'aideakey') USING UTF8) t.email,
CONVERT( AES_DECRYPT(t.email,'aideakey') USING UTF8) email,
t.member_id,
t.accounts_id,
t.del_flag,
......@@ -167,16 +170,12 @@
t.update_by,
t.open_id,
t.storeid,
CONVERT( AES_DECRYPT(offline.birthday,'aideakey') USING UTF8) offline.birthday,
offline.sex,
t.area,
t.fanss_store_id,t.doctor_id,
t.invitcode,t.compan,
offline.name memberName,
offline.phone memberPhone,
offline.storeid memberStoreId
t.fanss_store_id,
t.doctor_id,
t.invitcode,
t.compan
FROM wx_mp_member t
left join wx_mp_member_offline offline on offline.member_id = t.member_id and t.del_flag=0
WHERE t.id=#{id}
</select>
......@@ -207,7 +206,6 @@
member.id,
member.number,
member.name,
member.surname,
CONVERT(AES_DECRYPT(member.phone,'aideakey') USING UTF8) member.phone,
member.imageurl,
member.member_id,
......@@ -244,9 +242,6 @@
<if test="name != null">
name = #{name, jdbcType=VARCHAR},
</if>
<if test="surname!=null">
surname = #{surname},
</if>
<if test="phone != null">
phone = AES_ENCRYPT(#{phone, jdbcType=VARBINARY},'aideakey'),
</if>
......@@ -302,16 +297,19 @@
fanss_store_id = #{fanssStoreId, jdbcType=VARCHAR},
</if>
<if test="doctorId != null">
doctor_id = #{doctorId, jdbcType=VARCHAR}
doctor_id = #{doctorId, jdbcType=VARCHAR},
</if>
<if test="invitcode != null">
invitcode = #{invitcode, jdbcType=VARCHAR}
invitcode = #{invitcode, jdbcType=VARCHAR},
</if>
<if test="compan != null">
compan = #{compan, jdbcType=VARCHAR}
compan = #{compan, jdbcType=VARCHAR},
</if>
<if test="serviceId != null">
service_id = #{serviceId, jdbcType=VARCHAR}
service_id = #{serviceId, jdbcType=VARCHAR},
</if>
<if test="auditTime != null">
audit_time = #{auditTime, jdbcType=TIMESTAMP},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
......@@ -330,10 +328,14 @@
CONVERT(AES_DECRYPT(m.phone,'aideakey') USING UTF8) as phone,
m.open_id AS openId,
m.create_time as createTime,
m.member_id memberId,
m.source,
m.cardid
m.cardid,
m.status,
m.invitcode,
q.name serviceName
FROM
wx_mp_member m
wx_mp_member m LEFT JOIN t_qyuser q ON m.service_id = q.id
<include refid="sqlWhere"/>
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
......@@ -348,9 +350,27 @@
<!--个人信息回填
-->
<select id="memberFormation" parameterType="java.lang.String" resultType="com.cftech.member.model.MemberVO">
SELECT id,name memberName, sex, CONVERT(AES_DECRYPT(birthday,'aideakey')USING UTF8) birthday, imageurl,
CONVERT(AES_DECRYPT(email,'aideakey')USING UTF8) AS mailbox, CONVERT(AES_DECRYPT(phone,'aideakey')USING UTF8) as phone, cardid
FROM wx_mp_member WHERE open_id = #{openid} and del_flag=0
SELECT
t.id,
t.name memberName,
t.sex,
CONVERT(AES_DECRYPT(t.birthday, 'aideakey')USING UTF8) birthday,
t.imageurl,
CONVERT(AES_DECRYPT(t.email, 'aideakey')USING UTF8) AS mailbox,
CONVERT(AES_DECRYPT(t.phone, 'aideakey')USING UTF8) as phone,
t.cardid,
t.status,
t.storeid,
o.org_name hospitalsName,
t.invitcode,
t.audit_time auditTime,
t.open_id openid,
t.service_id serviceId,
u.name serviceName
FROM wx_mp_member t
LEFT JOIN t_orgunit o ON t.storeid = o.id
LEFT JOIN t_qyuser u ON t.service_id = u.id
WHERE t.open_id = #{openid} and t.del_flag = 0
</select>
<select id="fanssChat" resultType="com.cftech.member.model.FanssVO">
......@@ -359,10 +379,13 @@
f.openid,
f.nickname nickname,
f.headimgurl,
CASE WHEN au.id IS NOT NULL THEN '1' ELSE '0' END isThree
m.status isThree,
m.invitcode invitcode,
m.cardid cardid,
o.org_name hospital
FROM wx_mp_fanss f
LEFT JOIN wx_mp_member m ON f.openid = m.open_id AND m.del_flag = '0'
LEFT JOIN t_aidea_authentication au ON m.cardid = au.id_card AND au.del_flag = '0' AND au.status = '0'
LEFT JOIN t_orgunit o ON m.storeid = o.id
WHERE f.openid = #{openid} and f.delflag = '0'
</select>
......@@ -389,10 +412,25 @@
imageurl = #{imageUrl},
</if>
<if test="cardid != null ">
cardid = #{cardid}
cardid = #{cardid},
</if>
<if test="compan != null ">
compan = #{compan}
compan = #{compan},
</if>
<if test="serviceId != null">
service_id = #{serviceId, jdbcType=VARCHAR},
</if>
<if test="auditTime != null">
audit_time = #{auditTime, jdbcType=TIMESTAMP},
</if>
<if test="invitcode != null">
invitcode = #{invitcode, jdbcType=VARCHAR},
</if>
<if test="storeid != null">
storeid = #{storeid, jdbcType=VARCHAR},
</if>
<if test="status != null">
status = #{status, jdbcType=VARCHAR},
</if>
</set>
where id =#{id}
......
package com.cftech.member.group.dao;
import com.cftech.core.generic.GenericDao;
import com.cftech.member.group.model.MemberGroup;
/**
* 用户类型Mapper
*
* @author Strive
* @date: 2021-07-08 15:54
*/
public interface MemberGroupMapper extends GenericDao<MemberGroup> {
}
\ 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.member.group.dao.MemberGroupMapper">
<resultMap id="resultMap" type="com.cftech.member.group.model.MemberGroup">
<id column="id" property="id"/>
<result column="number" property="number"/>
<result column="name" property="name"/>
<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,
number,
name,
accounts_id,
del_flag,
status,
create_time,
update_time,
description,
create_by,
update_by
</sql>
<insert id="save" parameterType="com.cftech.member.group.model.MemberGroup" useGeneratedKeys="true"
keyProperty="id">
insert into t_aidea_member_group
(
<include refid="sqlColumns"/>
)
values
(
#{id, jdbcType=BIGINT},
#{number, jdbcType=VARCHAR},
#{name, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},
#{delFlag, jdbcType=TINYINT},
#{status, jdbcType=VARCHAR},
now(),
now(),
#{description, jdbcType=VARCHAR},
#{createBy, jdbcType=BIGINT},
#{updateBy, jdbcType=BIGINT}
)
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_member_group t
WHERE t.id=#{id}
</select>
<select id="count" parameterType="java.util.Map" resultType="java.lang.Integer">
SELECT COUNT(1) FROM t_aidea_member_group
<include refid="sqlWhere"/>
</select>
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
<include refid="sqlColumns"/>
FROM t_aidea_member_group
<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.member.group.model.MemberGroup">
update t_aidea_member_group
<set>
<if test="id != null">
id = #{id, jdbcType=BIGINT},
</if>
<if test="number != null">
number = #{number, jdbcType=VARCHAR},
</if>
<if test="name != null">
name = #{name, 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_member_group
set del_flag=1
where id = #{id,jdbcType=BIGINT}
</update>
</mapper>
\ No newline at end of file
package com.cftech.member.group.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 用户类型
*
* @author Strive
* @date: 2021-07-08 15:54
*/
@Data
public class MemberGroup implements Serializable {
/* 主键id */
private Long id;
/* 编码 */
@ExportConfig(value = "编码", width = 100, showLevel = 1)
private String number;
/* 类型名称 */
@ExportConfig(value = "类型名称", width = 100, showLevel = 1)
private String name;
/* 所属的账号 */
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 MemberGroup() {
this.delFlag = false;
this.status = "0";
}
}
\ No newline at end of file
package com.cftech.member.group.service;
import com.cftech.core.generic.GenericService;
import com.cftech.member.group.model.MemberGroup;
/**
* 用户类型Service
*
* @author Strive
* @date: 2021-07-08 15:54
*/
public interface MemberGroupService extends GenericService<MemberGroup> {
}
package com.cftech.member.group.service.impl;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.member.group.dao.MemberGroupMapper;
import com.cftech.member.group.model.MemberGroup;
import com.cftech.member.group.service.MemberGroupService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
/**
* 用户类型ServiceImpl
*
* @author Strive
* @date: 2021-07-08 15:54
*/
@Service("memberGroupService")
public class MemberGroupServiceImpl extends GenericServiceImpl<MemberGroup> implements MemberGroupService {
@Autowired
@Qualifier("memberGroupMapper")
private MemberGroupMapper memberGroupMapper;
@Override
public GenericDao<MemberGroup> getGenericMapper() {
return memberGroupMapper;
}
}
\ No newline at end of file
package com.cftech.member.group.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.base.codingrule.utils.CodingruleUtils;
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.member.group.model.MemberGroup;
import com.cftech.member.group.service.MemberGroupService;
import com.cftech.member.model.Member;
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 MEMBERGROUP_VIEW = "qy:memberGroup:view"
* 查看:public static final String MEMBERGROUP_EDIT = "qy:memberGroup:edit"
*
* @author Strive
* @date: 2021-07-08 15:54
*/
@Slf4j
@Controller
@RequestMapping("/a/memberGroup")
public class MemberGroupController {
public static final String MEMBERGROUP_VIEW = "qy:memberGroup:view";
public static final String MEMBERGROUP_EDIT = "qy:memberGroup:edit";
@Autowired
private MemberGroupService memberGroupService;
@Autowired
private CodingruleUtils codingruleUtils;
//列表页面
@RequiresPermissions(value = MEMBERGROUP_VIEW)
@RequestMapping("/list")
public String list(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
model.addAttribute("accountId", accountId);
return "memberGroup/memberGrouplist";
}
//编辑页面(新增、修改)
@RequiresPermissions(value = MEMBERGROUP_VIEW)
@RequestMapping("/form")
public String form(HttpServletRequest request, String id, Model model) {
if (!StringUtils.isEmpty(id)) {
MemberGroup memberGroup = memberGroupService.fetchById(id);
model.addAttribute("data", memberGroup);
}
return "memberGroup/memberGroupform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = MEMBERGROUP_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(MemberGroup memberGroup, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (memberGroup != null && memberGroup.getId() != null) {
memberGroup.setUpdateBy(UserUtils.getUser().getId());
memberGroupService.update(memberGroup);
rtnJson.put("errorNo", 0);
} else {
memberGroup.setAccountsId(accountsId);
memberGroup.setNumber(codingruleUtils.getNumber(accountsId, MemberGroup.class.getName()));
memberGroup.setDelFlag(false);
memberGroup.setAccountsId(UserUtils.getmpaccounts(request));
memberGroup.setCreateBy(UserUtils.getUser().getId());
memberGroup.setUpdateBy(UserUtils.getUser().getId());
memberGroupService.save(memberGroup);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = MEMBERGROUP_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, MemberGroup memberGroup, 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<MemberGroup> list = memberGroupService.fetchSearchByPage(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = memberGroupService.count(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);
return rtnJson;
}
//删除数据
@RequiresPermissions(value = MEMBERGROUP_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
memberGroupService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = MEMBERGROUP_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<MemberGroup> list = memberGroupService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(MemberGroup.class, response).toExcel(list, "用户类型信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = MEMBERGROUP_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(MemberGroup.class, response).toExcel(null, "用户类型信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = MEMBERGROUP_EDIT)
public String importExcel(HttpServletRequest request, MultipartFile file, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
if (file == null) {
return list(request, model);
}
// 构造临时路径来存储上传的文件
String uploadPath = System.getProperty("java.io.tmpdir");
File uploadDir = new File(uploadPath);
if (!uploadDir.exists()) {
uploadDir.mkdir();
}
String fileName = file.getOriginalFilename();
String filePath = uploadPath + File.separator + fileName;
File storeFile = new File(filePath);
try {
file.transferTo(storeFile);
ExcelKit.$Import().setEmptyCellValue("").readExcel(storeFile, rowData -> {
if (!StringUtils.isEmpty(rowData.get(0))) {
MemberGroup memberGroup = new MemberGroup();
memberGroup.setAccountsId(accountId);
memberGroupService.save(memberGroup);
}
});
} catch (IOException e) {
log.error(e.getMessage());
}
return list(request, model);
}
}
......@@ -15,4 +15,7 @@ public class FanssVO {
private String nickname;
private String headimgurl;
private String isThree;// 1:三期用户 2:非三期用户
private String invitcode;
private String cardid;
private String hospital;
}
......@@ -48,8 +48,7 @@ public class Member implements Serializable {
private Long accountsId;
/* 删除标识 */
private boolean delFlag;
/* 状态 */
private String status;
/* 创建时间 */
private Date createTime;
/* 更新时间 */
......@@ -65,14 +64,9 @@ public class Member implements Serializable {
//@ExportConfig(value = "openId", width = 100)
private String openId;
/**
* 绑定的门店
*/
private String storeid;
/**
* 注册时从粉丝表取的门店ID
*/
private Long fanssStoreId;
/*性别*/
......@@ -97,26 +91,12 @@ public class Member implements Serializable {
*/
private String area;
/**
* 所属客服id
*/
private String serviceId;
/**
* 所属药师id
*/
//private String oilSum;
private String doctorId;
/**
* 会员邀请码
*/
private String invitcode;
/**
* 是否三期患者
*/
private String compan;
/**
* 会员来源: 1:普通关注 2:医师二维码 3:客服二维码 4:医生二维码 5:组织二维码
......@@ -139,6 +119,37 @@ public class Member implements Serializable {
private String memberStoreId;
/**
* 入组医院id
*/
private String storeid;
/**
* CRC审批专员
*/
private String serviceId;
/**
* 审核时间
*/
private Date auditTime;
/**
* 是否审核通过 0:待审批 1:通过 2:拒绝
*/
private String status;
/**
* 随机号
*/
private String invitcode;
/**
* 是否三期患者
*/
private String compan;
public Member() {
this.delFlag = false;
this.source = "0";
......
......@@ -23,11 +23,29 @@ public class MemberDto {
private String name;
@ExportConfig(value = "会员手机",width = 100)
private String phone;
/**
* 随机码
*/
@ExportConfig(value = "随机码", width = 120)
private String invitcode;
@ExportConfig(value = "身份证",width = 100)
private String cardid;
@ExportConfig(value = "审核状态",width = 100)
private String status;
@ExportConfig(value = "粉丝来源",width = 100)
private String source;
@ExportConfig(value = "创建时间",width = 100)
private String createTime;
/**
* 审批人名称
*/
private String serviceName;
private String memberId;
}
......@@ -47,4 +47,34 @@ public class MemberVO {
* 是否三期患者
*/
private String compan;
/**
* 随机码
*/
private String invitcode;
/**
* 入组医院id
*/
private String storeid;
/**
* CRC入组专员id
*/
private String serviceId;
private Date auditTime;
private String status;
/**
* 入组医院名称
*/
private String hospitalsName;
/**
* CRC入组专员名称
*/
private String serviceName;
}
......@@ -5,6 +5,9 @@ import com.alibaba.fastjson.JSONObject;
import com.cftech.accounts.model.MpAccountsEntity;
import com.cftech.accounts.service.MpAccountsService;
import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.base.org.model.OrgUnit;
import com.cftech.base.org.service.OrgUnitService;
import com.cftech.base.org.service.QyuserService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.scope.OrderType;
......@@ -60,6 +63,9 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
@Autowired
private CodingruleUtils codingruleUtils;
@Autowired
private OrgUnitService orgUnitService;
@Override
public GenericDao<Member> getGenericMapper() {
return memberMapper;
......@@ -105,7 +111,7 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
public JSONObject memberFormation(String openid, String appId) {
JSONObject rtnJson = new JSONObject();
try {
if (org.springframework.util.StringUtils.isEmpty(openid)) {
if (StringUtils.isBlank(openid)) {
rtnJson.put("errorNo", "1");
rtnJson.put("errorMsg", "id不能为空");
return rtnJson;
......@@ -167,12 +173,19 @@ public class MemberServiceImpl extends GenericServiceImpl<Member> implements Mem
member.setCardid(memberVO.getCardid());
member.setPhone(memberVO.getPhone());
member.setImageurl(memberVO.getImageUrl());
member.setStoreid(memberVO.getStoreid());//入组医院
member.setInvitcode(memberVO.getInvitcode());//随机号
if (StringUtils.isNoneBlank(memberVO.getStoreid()) && StringUtils.isNoneBlank(memberVO.getInvitcode())) {
member.setStatus("0");//待审批
}
memberMapper.save(member);
rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg", "修改成功");
return rtnJson;
} else {
if (StringUtils.equals("2", memberVOS.get(0).getStatus()) && StringUtils.isNoneBlank(memberVO.getStoreid()) && StringUtils.isNoneBlank(memberVO.getInvitcode())) {
memberVO.setStatus("0");
}
memberMapper.updateMember(memberVO);
rtnJson.put("errorNo", "0");
rtnJson.put("errorMsg", "修改成功");
......
......@@ -3,6 +3,8 @@ package com.cftech.member.web;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.cftech.base.codingrule.utils.CodingruleUtils;
import com.cftech.base.org.model.OrgUnit;
import com.cftech.base.org.service.OrgUnitService;
import com.cftech.core.annotation.CSRFTokenRef;
import com.cftech.core.config.MpGlobalConfig;
import com.cftech.core.poi.ExcelKit;
......@@ -10,12 +12,19 @@ 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.member.group.model.MemberGroup;
import com.cftech.member.group.service.MemberGroupService;
import com.cftech.member.model.Member;
import com.cftech.member.model.MemberDto;
import com.cftech.member.service.MemberService;
import com.cftech.mp.fans.model.MpFanssEntity;
import com.cftech.mp.fans.service.MpFanssService;
import com.cftech.shop.qrcode.model.Orgunit;
import com.cftech.sys.filter.McCsrfTokenRepository;
import com.cftech.sys.model.User;
import com.cftech.sys.model.UserRole;
import com.cftech.sys.security.UserUtils;
import com.cftech.sys.service.RoleService;
import com.cftech.workshop.workshop.model.Workshop;
import com.cftech.workshop.workshop.service.WorkshopService;
import com.ctc.wstx.util.StringUtil;
......@@ -40,6 +49,7 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
......@@ -60,18 +70,32 @@ public class MemberController {
public static final String MEMBER_VIEW = "qy:member:view";
public static final String MEMBER_EDIT = "qy:member:edit";
public static final String MEMBER_AUDIT = "qy:member:audit";
// @Autowired
// private McCsrfTokenRepository mcCsrfTokenRepository;
@Autowired
private MemberService memberService;
@Autowired
private CodingruleUtils codingruleUtils;
@Autowired
private WorkshopService workshopService;
@Autowired
private MpFanssService fanssService;
@Autowired
private RoleService roleService;
@Autowired
private OrgUnitService orgUnitService;
@Autowired
private MemberGroupService memberGroupService;
//列表页面
@RequiresPermissions(value = MEMBER_VIEW)
@RequestMapping("/listpl")
......@@ -90,6 +114,32 @@ public class MemberController {
return "member/memberlist";
}
//
@RequiresPermissions(value = MEMBER_VIEW)
@RequestMapping("/listaudit")
public String listaudit(HttpServletRequest request, Model model) {
Long accountId = UserUtils.getmpaccounts(request);
//获取患者类型数据
Conds conds = new Conds();
conds.equal("del_flag", Constants.DEL_FLAG_0);
Sort sort = new Sort("create_time", OrderType.DESC);
List<MemberGroup> groups = memberGroupService.fetchSearchByPage(conds, sort, 0, 0);
model.addAttribute("accountId", accountId);
model.addAttribute("groups", groups);
return "member/auditmemberlist";
}
@ResponseBody
@RequestMapping("/memberById")
public String memberById(String id) {
JSONObject retObj = new JSONObject();
Member member = memberService.fetchById(id);
retObj.put("member", member);
retObj.put("errorNo", 0);
return retObj.toString();
}
//编辑页面(新增、修改)
@RequiresPermissions(value = MEMBER_VIEW)
@RequestMapping("/form")
......@@ -138,41 +188,56 @@ public class MemberController {
Long accountsId = UserUtils.getmpaccounts(request);
String res = ESAPI.encoder().decodeForHTML("https://www.michang-tech.com.cn/aidea/static/mp/aidea/meeting-intro.html?appid=wxa53abdf500a8ee6d&amp;id=6");
System.out.print(res);
/*Conds conds = new Conds();
conds.equal("member.del_flag", Constants.DEL_FLAG_0);
conds.equal("member.accounts_id", accountsId);
if (!StringUtils.isEmpty(member.getNumber())) {
conds.like("member.number", member.getNumber());
}
Conds conds = new Conds();
conds.equal("m.del_flag", Constants.DEL_FLAG_0);
if (!StringUtils.isEmpty(member.getName())) {
conds.like("member.name", member.getName());
conds.like("m.name", member.getName());
}
if (!StringUtils.isEmpty(member.getPhone())) {
conds.like("member.phone", member.getPhone());
}
if (!StringUtils.isEmpty(member.getCardid())) {
conds.like("member.cardid", member.getCardid());
conds.like("CONVERT(AES_DECRYPT(m.phone,'aideakey') USING UTF8)", member.getPhone());
}
Sort sort = new Sort("member.create_time", OrderType.DESC);
List<Member> list = memberService.fetchSearchByPageServer(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = memberService.countServer(conds);
Sort sort = new Sort("m.create_time", OrderType.DESC);
List<MemberDto> list = memberService.selectmemberDto(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = memberService.selectmemberDtoCount(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
rtnJson.put("iTotalDisplayRecords", counts);
rtnJson.put("aaData", list);*/
rtnJson.put("aaData", list);
return rtnJson;
}
//获取列表数据
@CSRFTokenRef
@RequiresPermissions(value = MEMBER_VIEW)
@RequestMapping(value = "/listAuditData", method = {RequestMethod.POST})
@ResponseBody
public JSONObject listAuditData(int iDisplayStart, int iDisplayLength, Member member, HttpServletRequest request, HttpServletResponse response) {
Long accountsId = UserUtils.getmpaccounts(request);
User user = UserUtils.getUser();
//是否拥有药店主管角色 sys:leaders
boolean leader = roleService.selectRoleEntityByUserId(user.getId(), Constants.SYSTEM_LEADER);
Conds conds = new Conds();
conds.equal("m.del_flag", Constants.DEL_FLAG_0);
// if(member.getStatus().equals("1")){ //注册会员
// conds.isNull("m.status");
// }else if(member.getStatus().equals("2")){ //虚拟会员
// conds.equal("m.status",1);
// }
// if (!StringUtils.isEmpty(member.getCompan())) {
// conds.like("m.compan", member.getCompan());
// }
//权限控制
if (user.getId() != 1 && !leader) {
//获取当前人对应的审核部门
Conds orgConds = new Conds();
orgConds.equal("t.del_flag", Constants.DEL_FLAG_0);
orgConds.equal("t.three_phase_auditor", user.getUserid());
List<OrgUnit> list = orgUnitService.fetchSearchByPage(orgConds, null, 0, 0);
Long[] ids = new Long[list.size()];
for(int i=0; i<list.size(); i++) {
ids[i] = list.get(i).getId();
}
if (ids.length == 0) { ids[0] = 0L; }
conds.in("m.storeid", ids);
}
if (!StringUtils.isEmpty(member.getName())) {
conds.like("m.name", member.getName());
......@@ -181,7 +246,6 @@ public class MemberController {
conds.like("CONVERT(AES_DECRYPT(m.phone,'aideakey') USING UTF8)", member.getPhone());
}
Sort sort = new Sort("m.create_time", OrderType.DESC);
List<MemberDto> list = memberService.selectmemberDto(conds, sort, iDisplayStart, iDisplayLength);
......@@ -194,6 +258,43 @@ public class MemberController {
}
//删除数据
@RequiresPermissions(value = MEMBER_AUDIT)
@RequestMapping(value = "/audit", method = {RequestMethod.POST})
@ResponseBody
public JSONObject audit(String id, String status, String remarks, HttpServletRequest request, HttpServletResponse response) {
JSONObject rtnJosn = new JSONObject();
try {
Member member = memberService.fetchById(id);
if (member == null) {
rtnJosn.put("errorNo", 1);
throw new Exception("会员不存在");
}
member.setId(Long.parseLong(id));
member.setStatus(status);
member.setAuditTime(new Date());
member.setServiceId(UserUtils.getUser().getId().toString());
MpFanssEntity fanssEntity = new MpFanssEntity();
fanssEntity.setOpenid(member.getOpenId());
if (org.apache.commons.lang.StringUtils.equals(status, "1")) {
member.setCompan("1");
fanssEntity.setUnionid("1");//三期患者
} else if (org.apache.commons.lang.StringUtils.equals(status, "2")) {
member.setCompan("0");
fanssEntity.setUnionid("0");//普通人员
}
if (org.apache.commons.lang.StringUtils.isNotBlank(remarks)) {
member.setDescription(remarks);
}
memberService.update(member);
fanssService.updateByOpenId(fanssEntity);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequiresPermissions(value = MEMBER_EDIT)
@RequestMapping(value = "/delete", method = {RequestMethod.POST})
@ResponseBody
......
......@@ -126,36 +126,63 @@
'3') selected="selected" #end>实验室</option>
</select>
</div>
<!--<div class="form-group form-md-line-input">-->
<!--<label>组织分类</label>-->
<!--<div class="input-group">-->
<!--<input type="text" id="orgtypeId" name="orgtypeId" value="$!{data.orgtypeId}"-->
<!--class="form-control" style="display: none">-->
<!--<input type="text" id="orgtypeName" name="orgtypeName" value="$!{orgtypeName}"-->
<!--class="form-control" disabled>-->
<!--<span class="input-group-btn">-->
<!--<button type="button" id="orgtypeSelect"-->
<!--class="btn btn-info btn-flat">选择</button>-->
<!--</span>-->
<!--</div>-->
<!--</div>-->
<!--<div class="checkbox">-->
<!--<label>-->
<!--<input type="checkbox" id="isAdminUnit" name="isAdminUnit"-->
<!--#if($data.isAdminUnit== true ) checked="checked" #end-->
<!--&gt; 行政组织-->
<!--</label>-->
<!--<label>-->
<!--<input type="checkbox" id="isSalesUnit" name="isSalesUnit"-->
<!--#if($data.isSalesUnit== true ) checked="checked" #end-->
<!--&gt; 销售组织-->
<!--</label>-->
<!--</div>-->
<!--<div class="form-group form-md-line-input">-->
<!--<label for="wxorgId" class="col-md-2 control-label">同步微信组织ID</label>-->
<!--<input type="text" name="wxorgId" id="wxorgId" value="$!{data.wxorgId}"-->
<!--class="form-control" readonly>-->
<!--</div>-->
<div class="form-group form-md-line-input" id="salesManagerId" style="display:none">
<label>销售代表</label>
<div class="input-group">
<input type="text" name="salesManager" id="salesManager"
value="$!{data.salesManager}" class="form-control"
style="display: none">
<input type="text" id="salesManagerName" name="salesManagerName"
value="$!{salesManagerName}" class="form-control selDoctor" readonly>
<span class="input-group-btn">
<button type="button" name="selSalesManager" id="selSalesManager"
class="btn btn-info btn-flat selDoctor">选择</button>
</span>
</div>
</div>
<div class="form-group form-md-line-input" id="threePhase" style="display:none">
<label>入组医院</label>
<div class="radio">
<label> <input type="radio" name="isThreePhase"
id="isThreePhase_True" value="1" #if($!{data.isThreePhase}== '1') checked #end>
</label>
<label> <input
type="radio" name="isThreePhase" id="isThreePhase_False"
value="0" #if($!{data.isThreePhase} == '0' || $!{data.isThreePhase} == '') checked #end>
</label>
</div>
</div>
<div class="form-group form-md-line-input" id="hospitalTypeId" style="display:none">
<label for="hospitalType">医院分类</label>
<select class="form-control" name="hospitalType" id="hospitalType">
<option value="" >请选择</option>
<option value="A" #if($!{data.hospitalType}==
'A') selected="selected" #end>A类</option>
<option value="B" #if($!{data.hospitalType}==
'B') selected="selected" #end>B类</option>
<option value="C" #if($!{data.hospitalType}==
'C') selected="selected" #end>C类</option>
</select>
</div>
<div class="form-group form-md-line-input" id="threePhaseAuditorId" style="display:none">
<label>CRC审核专员</label>
<div class="input-group">
<input type="text" name="threePhaseAuditor" id="threePhaseAuditor"
value="$!{data.threePhaseAuditor}" class="form-control"
style="display: none">
<input type="text" id="threePhaseAuditorName" name="threePhaseAuditorName"
value="$!{threePhaseAuditorName}" class="form-control selDoctor" readonly>
<span class="input-group-btn">
<button type="button" name="selThreePhaseAuditor" id="selThreePhaseAuditor"
class="btn btn-info btn-flat selDoctor">选择</button>
</span>
</div>
</div>
</div>
<div class="box-footer">
......@@ -211,8 +238,23 @@
$().ready(function () {
Cfapp.init();
formAdd.init();
initPageView();
});
//页面初始化
var orgtypeId = "${data.orgtypeId}";
var isThreePhase = "${data.isThreePhase}";
function initPageView() {
if (orgtypeId == "1") {
$('#threePhase').show();
$('#salesManagerId').show();
if (isThreePhase == "1") {
$('#hospitalTypeId').show();
$('#threePhaseAuditorId').show();
}
}
}
var formAdd = function () {
......@@ -223,6 +265,28 @@
bindEvent();
};
var bindEvent = function () {
$('#orgtypeId').on('change', function(e) {
if ($(this).val() == '1') {
$('#threePhase').show();
$('#salesManagerId').show();
} else {
$('#threePhase').hide();
$('#salesManagerId').hide();
$('#hospitalTypeId').hide();
$('#threePhaseAuditorId').hide();
}
});
$('input[name="isThreePhase"]').on('click', function() {
if ($(this).val() == '1') {
$('#hospitalTypeId').show();
$('#threePhaseAuditorId').show();
} else {
$('#hospitalTypeId').hide();
$('#threePhaseAuditorId').hide();
}
})
$('#parentOrgSelect').on('click',
function () {
Cfapp.treeSingleSelect({
......@@ -238,40 +302,89 @@
}
})
});
var getOrgTypeUrl = "#springUrl('/a/orgtype/listData')";
$('#orgtypeSelect').on('click',
function () {
$('#selSalesManager').on('click', function() {
Cfapp.f7({
dataUrl: getOrgTypeUrl, //导入的action Url
checkType: 'single', // 多选为multi
title: "组织分类选择",
dataUrl: "#springUrl('/a/wxQrcode/listUser?type=" + 5 + "')",
checkType: "single", // 多选为multi
title: '请选择销售代表',
btnoktext: "确定",
btncanceltext: "取消",
columns: ['选择', '组织分类编码', '组织分类名称'],
columns: ["选择", "销售代表名称"],
isSearch: '0',
searchColumns: ["name"],//搜索的字段名称
searchColumnsRemarks: ["销售代表"],//搜索的字段备注
aoColumns: [{
"mData": "id"
}, {
"mData": "number"
"mData": "name"
}],
aoColumnDefs: [{
"aTargets": [0],
"mData": "id",
"mRender": function (a, b, c, d) {
return '<input class="bindId" value="' + a + '" type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
}
}, {
"aTargets": [1],
"mData": "name",
"mRender": function (a, b, c, d) {//a表示createtime对应的值,c表示当前记录行对象
return a;
}
}],
success: function () {
},
cancel: function () {
},
storeFields: 'salesManager', // 储存的字段
displayFields: 'salesManagerName'
})
});
$('#selThreePhaseAuditor').on('click', function() {
Cfapp.f7({
dataUrl: "#springUrl('/a/wxQrcode/listUser?type=" + 6 + "')",
checkType: "single", // 多选为multi
title: '请选择CRC审核专员',
btnoktext: "确定",
btncanceltext: "取消",
columns: ["选择", "CRC审核专员名称"],
isSearch: '0',
searchColumns: ["name"],//搜索的字段名称
searchColumnsRemarks: ["CRC审核专员"],//搜索的字段备注
aoColumns: [{
"mData": "id"
}, {
"mData": "name"
}],
aoColumnDefs: [{
"aTargets": [0],
"mData": "id",
"mRender": function (a, b, c, d) {
return '<input class="bindId" value="' + a + '" type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
}
}, {
"aTargets": [1],
"mData": "name",
"mRender": function (a, b, c, d) {//a表示createtime对应的值,c表示当前记录行对象
return '<input type="radio" id="' + a + '" name="sel" data-value="' + a + '" data-name="' + c.name + '">';
return a;
}
}],
success: function () {
}, //确定处理
},
cancel: function () {
}, // 取消的处理
displayFields: 'orgtypeName', //显示的字段
storeFields: 'orgtypeId' // 储存的字段
},
storeFields: 'threePhaseAuditor', // 储存的字段
displayFields: 'threePhaseAuditorName'
})
});
var getOrgTypeUrl = "#springUrl('/a/orgtype/listData')";
$("#myForm").validate({
rules: {
orgName: {
......@@ -311,7 +424,7 @@
});
} else if (returnobj.errorNo == 2) {
Cfapp.alert({
message: "更新失败",
message: "组织名称不能重复",
btntext: "确定",
success: function () {
location.href = "#springUrl('/a/orgunit/list')";
......
......@@ -345,7 +345,7 @@
var zNodes = data.aaData;
tree = $.fn.zTree.init(orgTree, setting, zNodes);
tree.expandAll(true);
//tree.expandAll(true);
tree.expandNode(tree.getNodesByFilter(function (node) {
return node.level == 0;
}, true), true, false, false);
......
......@@ -170,6 +170,8 @@
<option label="客服" value="2" #if($data.userType == '2') selected #end>客服</option>
<option label="医生" value="3" #if($data.userType == '3') selected #end>医生</option>
<option label="订单员" value="4" #if($data.userType == '4') selected #end>订单员</option>
<option label="销售代表" value="5" #if($data.userType == '5') selected #end>销售代表</option>
<option label="CRC审核专员" value="6" #if($data.userType == '6') selected #end>CRC审核专员</option>
</select>
</div>
......
......@@ -365,6 +365,12 @@
case "4":
postion = "订单员";
break;
case "5":
postion = "销售代表";
break;
case "6":
postion = "CRC审核专员";
break;
}
return "<font color='blue'>" +postion + "</font>";
}
......@@ -449,7 +455,7 @@
var zNodes = data.aaData;
tree = $.fn.zTree.init(orgTree, setting, zNodes);
tree.expandAll(true);
//tree.expandAll(true);
tree.expandNode(tree.getNodesByFilter(function (node) {
return node.level == 0;
}, true), true, false, false);
......
......@@ -21,6 +21,10 @@
<result column="orgtype_id" property="orgtypeId"/>
<result column="parentName" property="parentName"/>
<result column="parentCode" property="parentCode"/>
<result column="sales_manager" property="salesManager"/>
<result column="is_three_phase" property="isThreePhase"/>
<result column="three_phase_auditor" property="threePhaseAuditor"/>
<result column="hospital_type" property="hospitalType"/>
</resultMap>
<resultMap id="resultMapVO" type="com.cftech.base.org.model.vo.OrgUnitVO">
......@@ -45,7 +49,9 @@
<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 == '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>
......@@ -60,32 +66,36 @@
</sql>
<sql id="sqlColumns">
id, `number`, create_by, create_time, update_by, update_time, del_flag, org_name, accounts_id,status,parent_id,
parent_ids,isadminunit,issalesunit,wxorg_id,orgtype_id
id
, `number`, create_by, create_time, update_by, update_time, del_flag, org_name, accounts_id,status,parent_id,
parent_ids, isadminunit, issalesunit, wxorg_id, orgtype_id, sales_manager, is_three_phase, three_phase_auditor, hospital_type
</sql>
<insert id="save" parameterType="com.cftech.base.org.model.OrgUnit" useGeneratedKeys="true" keyProperty="id">
insert into t_orgunit
(
id, `number`, create_by, create_time, update_by, update_time, del_flag, org_name, accounts_id,status,parent_id,
parent_ids,isadminunit,issalesunit,wxorg_id, orgtype_id
)
(id, `number`, create_by, create_time, update_by, update_time, del_flag, org_name, accounts_id, status,
parent_id, parent_ids, isadminunit, issalesunit, wxorg_id, orgtype_id,
sales_manager, is_three_phase, three_phase_auditor, hospital_type)
values
(
#{id, jdbcType=BIGINT}, #{number, jdbcType=VARCHAR} ,#{createBy, jdbcType=BIGINT}, now(), #{updateBy, jdbcType=BIGINT},
now(), #{delFlag, jdbcType=TINYINT}, #{orgName, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT},#{status, jdbcType=VARCHAR},#{parentId, jdbcType=BIGINT},
#{parentIds, jdbcType=VARCHAR}, #{isAdminUnit, jdbcType=TINYINT},#{isSalesUnit, jdbcType=TINYINT},#{wxorgId, jdbcType=VARCHAR},#{orgtypeId, jdbcType=BIGINT}
)
(#{id, jdbcType=BIGINT}, #{number, jdbcType=VARCHAR}, #{createBy, jdbcType=BIGINT}, now(),
#{updateBy, jdbcType=BIGINT}, now(), #{delFlag, jdbcType=TINYINT}, #{orgName, jdbcType=VARCHAR},
#{accountsId, jdbcType=BIGINT}, #{status, jdbcType=VARCHAR}, #{parentId, jdbcType=BIGINT},
#{parentIds, jdbcType=VARCHAR}, #{isAdminUnit, jdbcType=TINYINT}, #{isSalesUnit, jdbcType=TINYINT},
#{wxorgId, jdbcType=VARCHAR}, #{orgtypeId, jdbcType=BIGINT}, #{salesManager, jdbcType=VARCHAR},
#{isThreePhase, jdbcType=VARCHAR}, #{threePhaseAuditor, jdbcType=VARCHAR}, #{hospitalType, jdbcType=VARCHAR})
</insert>
<select id="fetchById" parameterType="java.lang.Long" resultMap="resultMap">
SELECT <include refid="sqlColumns" /> FROM t_orgunit t
SELECT
<include refid="sqlColumns"/>
FROM t_orgunit t
WHERE t.id=#{id}
</select>
<select id="findAllByAccountId" parameterType="java.lang.Long" resultMap="resultMap">
SELECT <include refid="sqlColumns" /> FROM t_orgunit t
SELECT
<include refid="sqlColumns"/>
FROM t_orgunit t
WHERE t.del_flag = 0 and accounts_id = #{accountsId, jdbcType=BIGINT}
</select>
......@@ -98,12 +108,14 @@
<select id="fetchSearchByPage" parameterType="java.util.Map" resultMap="resultMap">
SELECT
t.id, t.`number`, t.create_by, t.create_time, t.update_by, t.update_time, t.del_flag, t.org_name, t.accounts_id, t.status, t.parent_id,
t.parent_ids, t.isadminunit, t.issalesunit, t.wxorg_id, t.orgtype_id, parent.number parentCode, parent.org_name parentName
t.id, t.`number`, t.create_by, t.create_time, t.update_by, t.update_time, t.del_flag, t.org_name, t.accounts_id,
t.status, t.parent_id,
t.parent_ids, t.isadminunit, t.issalesunit, t.wxorg_id, t.orgtype_id, parent.number parentCode, parent.org_name
parentName
FROM t_orgunit t
LEFT JOIN t_orgunit parent ON parent.id = t.parent_id
<include refid="sqlWhere"/>
-- and instr(t.parent_ids,'${orgId},')>0
-- and instr(t.parent_ids,'${orgId},')>0
<if test="sort!=null">ORDER BY ${sort.param} ${sort.type}</if>
<if test="limit>0">limit #{offset},#{limit}</if>
</select>
......@@ -159,12 +171,27 @@
<if test="orgtypeId != null">
orgtype_id = #{orgtypeId, jdbcType=BIGINT},
</if>
<if test="salesManager != null">
sales_manager = #{salesManager, jdbcType=VARCHAR},
</if>
<if test="isThreePhase != null">
is_three_phase = #{isThreePhase, jdbcType=VARCHAR},
</if>
<if test="threePhaseAuditor != null">
three_phase_auditor = #{threePhaseAuditor, jdbcType=TINYINT},
</if>
<if test="hospitalType != null">
hospital_type = #{hospitalType, jdbcType=TINYINT},
</if>
</set>
where id=#{id,jdbcType=BIGINT}
</update>
<update id="delete" parameterType="java.lang.Long">
update t_orgunit set del_flag=1 where id=#{id,jdbcType=BIGINT}
update t_orgunit
set del_flag=1
where id = #{id,jdbcType=BIGINT}
</update>
<update id="changeStatus" parameterType="java.util.Map">
......@@ -173,8 +200,13 @@
</update>
<update id="move" parameterType="java.util.Map">
update t_orgunit set parent_id = #{parentId,jdbcType=BIGINT}, parent_ids = #{newParentIds,jdbcType=VARCHAR} where id = #{id,jdbcType=BIGINT};
update t_orgunit set parent_ids = replace(parent_ids,#{oldParentIds,jdbcType=VARCHAR},#{newParentIds,jdbcType=VARCHAR}) where parent_ids like CONCAT('',#{oldParentIds,jdbcType=VARCHAR},'%');
update t_orgunit
set parent_id = #{parentId,jdbcType=BIGINT},
parent_ids = #{newParentIds,jdbcType=VARCHAR}
where id = #{id,jdbcType=BIGINT};
update t_orgunit
set parent_ids = replace(parent_ids, #{oldParentIds,jdbcType=VARCHAR}, #{newParentIds,jdbcType=VARCHAR})
where parent_ids like CONCAT('', #{oldParentIds,jdbcType=VARCHAR}, '%');
</update>
<select id="fetchSearchVOByPage" parameterType="java.util.Map" resultMap="resultMapVO">
......
......@@ -88,6 +88,26 @@ public class OrgUnit implements Serializable {
/* 状态 是否禁用,默认启用,0 启用,1禁用*/
private String status;
/**
* 销售主管
*/
private Long salesManager;
/**
* 是否三期入组医院
*/
private String isThreePhase;
/**
* 三期入组医院CRC审核专员
*/
private String threePhaseAuditor;
/**
* 三期入组医院审核类型
*/
private String hospitalType;
public OrgUnit() {
this.delFlag = false;
this.status = "0";
......
package com.cftech.base.org.web;
import com.alibaba.fastjson.JSONObject;
import com.cftech.base.org.model.OrgUnit;
import com.cftech.base.org.model.Qyuser;
import com.cftech.base.org.service.OrgUnitService;
import com.cftech.base.org.service.QyuserService;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -22,6 +26,21 @@ public class MobileQyuserController {
@Autowired
private QyuserService qyuserService;
@Autowired
private OrgUnitService orgUnitService;
@RequestMapping(value = "/getDepartmentList", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject getPhaseHospitalList() {
JSONObject retObj = new JSONObject();
Conds conds = new Conds();
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.equal("t.is_three_phase", Constants.TRUE);
Sort sort = new Sort("t.create_time", OrderType.DESC);
List<OrgUnit> list = orgUnitService.fetchSearchByPage(conds, sort, 0, 0);
retObj.put("errorNo", 0);
retObj.put("data", list);
return retObj;
}
@RequestMapping(value = "/getEmpList", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public JSONObject getEmpList(Long storeId) {
......@@ -34,7 +53,6 @@ public class MobileQyuserController {
obj.put("errorNo", "0");
obj.put("data", datas);
return obj;
}
......
......@@ -76,6 +76,18 @@ public class OrgUnitController {
if (!StringUtils.isEmpty(id)) {
OrgUnit orgUnit = orgUnitService.fetchById(id);
String parentOrgName = "";
String salesManagerName = "";//销售代表名称
String threePhaseAuditorName = "";//CRC审核专员名称
if (!StringUtils.isEmpty(orgUnit.getSalesManager())) {
Qyuser qyuser = qyuserService.fetchById(orgUnit.getSalesManager());
salesManagerName = qyuser != null ? qyuser.getName() : "";
}
if (!StringUtils.isEmpty(orgUnit.getThreePhaseAuditor())) {
Qyuser qyuser = qyuserService.fetchById(orgUnit.getThreePhaseAuditor());
threePhaseAuditorName = qyuser != null ? qyuser.getName() : "";
}
if (orgUnit.getParentId() == 0) {
parentOrgName = rootOrgName;
......@@ -83,10 +95,9 @@ public class OrgUnitController {
OrgUnit parentOrgUnit = orgUnitService.fetchById(orgUnit.getParentId());
parentOrgName = parentOrgUnit.getOrgName();
}
// if (orgUnit.getOrgtypeId() != null) {
// Orgtype orgtype = orgtypeService.fetchById(orgUnit.getOrgtypeId());
// model.addAttribute("orgtypeName", orgtype.getName());
// }
model.addAttribute("salesManagerName", salesManagerName);
model.addAttribute("threePhaseAuditorName", threePhaseAuditorName);
model.addAttribute("data", orgUnit);
model.addAttribute("parentName", parentOrgName);
model.addAttribute("accountId", orgUnit.getAccountsId());
......@@ -123,6 +134,17 @@ public class OrgUnitController {
JSONObject rtnJson = new JSONObject();
try {
if (orgUnit != null && orgUnit.getId() != null) {
//判断名称不能重复
Conds conds = new Conds();
conds.equal("t.org_name", orgUnit.getOrgName());
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
conds.notEqual("t.id", orgUnit.getId());
OrgUnit oldOrgUnit = orgUnitService.fetchSearchByConds(conds);
if (oldOrgUnit != null) {
rtnJson.put("errorNo", 2);
throw new Exception("组织名称不能重复");
}
//do update
orgUnit.setUpdateBy(UserUtils.getUser().getId());
OrgUnit parentOrgUnit = null;
......@@ -146,12 +168,23 @@ public class OrgUnitController {
} else {
if (!qyOrgUtil.update(orgUnit)) {
log.error("同步微信端出错," + orgUnit.toString());
throw new Exception("同步微信端出错");
}
}
orgUnitService.updateCache(orgUnit);
rtnJson.put("errorNo", 0);
} else {
//判断名称不能重复
Conds conds = new Conds();
conds.equal("t.org_name", orgUnit.getOrgName());
conds.equal("t.del_flag", Constants.DEL_FLAG_0);
OrgUnit oldOrgUnit = orgUnitService.fetchSearchByConds(conds);
if (oldOrgUnit != null) {
rtnJson.put("errorNo", 2);
throw new Exception("组织名称不能重复");
}
orgUnit.setAccountsId(accountsId);
orgUnit.setNumber(codingruleUtils.getNumber(accountsId, OrgUnit.class.getName()));
// do create
......@@ -167,7 +200,6 @@ public class OrgUnitController {
orgUnit.setParentIds(parentOrgUnit == null ? "0,1," : parentOrgUnit.getParentIds());
orgUnit.setCreateBy(UserUtils.getUser().getId());
orgUnit.setUpdateBy(UserUtils.getUser().getId());
orgUnitService.saveCache(orgUnit);
int wxorgid = qyOrgUtil.create(orgUnit, parentOrgUnit);
if (wxorgid == -1 || wxorgid == 0) {
......@@ -175,12 +207,11 @@ public class OrgUnitController {
throw new Exception("同步微信端出错");
} else {
orgUnit.setWxorgId("" + wxorgid);
orgUnitService.saveCache(orgUnit);
}
orgUnit.setParentIds(orgUnit.getParentIds() + orgUnit.getId() + ",");
orgUnitService.updateCache(orgUnit);
rtnJson.put("errorNo", 0);
}
} catch (Exception e) {
......@@ -464,7 +495,7 @@ public class OrgUnitController {
}
Sort sort = new Sort("t.create_time", OrderType.DESC);
Sort sort = new Sort("t.create_time", OrderType.ASC);
List<OrgUnitVO> list = orgUnitService.fetchSearchVOByPage(orgId, conds, sort, iDisplayStart, iDisplayLength);
Conds myCond = new Conds();
......
......@@ -11,7 +11,8 @@ import java.util.Map;
/**
* 角色Dao 接口
**/
public interface RoleMapper{
public interface RoleMapper {
int countByExample(RoleExample example);
int deleteByExample(RoleExample example);
......@@ -62,6 +63,7 @@ public interface RoleMapper{
* @return
*/
List<UserRole> selectRolesByUserAccountsId(Map<String, Object> params);
/**
* 通过公众号ID查询拥有的角色
*
......@@ -72,8 +74,11 @@ public interface RoleMapper{
/**
* 通过角色编码
*
* @param params
* @return
*/
List<Role> selectAllSign(Map<String, Object> params);
Integer selectRoleEntityByUserId(Map<String, Object> params);
}
\ No newline at end of file
......@@ -12,8 +12,6 @@
</collection>
</resultMap>
<resultMap id="BaseResultMap" type="com.cftech.sys.model.Role">
<id column="id" property="id" jdbcType="BIGINT" />
<result column="role_name" property="roleName" jdbcType="VARCHAR" />
......@@ -34,7 +32,6 @@
WHERE a.id = #{id}
</select>
<select id="selectAll" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
<include refid="Base_Column_List" />
......@@ -56,12 +53,6 @@
and role_sign != 'sys:dealer'
</select>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
......@@ -91,6 +82,7 @@
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
......@@ -120,9 +112,11 @@
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, role_name, role_sign, description
</sql>
<select id="selectByExample" resultMap="BaseResultMap" parameterType="com.cftech.sys.model.RoleExample">
select
<if test="distinct">
......@@ -137,22 +131,26 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
select
<include refid="Base_Column_List" />
from role
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from role
where id = #{id,jdbcType=BIGINT}
</delete>
<delete id="deleteByExample" parameterType="com.cftech.sys.model.RoleExample">
delete from role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.cftech.sys.model.Role">
insert into role (id, role_name, role_sign,
description)
......@@ -206,8 +204,6 @@
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.cftech.sys.model.Role">
insert into role
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -239,12 +235,14 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.cftech.sys.model.RoleExample" resultType="java.lang.Integer">
select count(*) from role
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update role
<set>
......@@ -269,7 +267,6 @@
</if>
</update>
<update id="updateRole" parameterType="com.cftech.sys.model.Role">
update role
<set>
......@@ -288,11 +285,8 @@
updatetime = #{updatetime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
</set>
</update>
<update id="updateByExample" parameterType="map">
update role
set id = #{record.id,jdbcType=BIGINT},
......@@ -305,6 +299,7 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.cftech.sys.model.Role">
update role
<set>
......@@ -323,6 +318,7 @@
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.cftech.sys.model.Role">
update role
set role_name = #{roleName,jdbcType=VARCHAR},
......@@ -347,6 +343,14 @@
SELECT * FROM user_role where user_id=#{userId,jdbcType=BIGINT}
</select>
<!-- 查询用户是否拥有权限 -->
<select id="selectRoleEntityByUserId" resultType="java.lang.Integer" parameterType="java.util.Map">
SELECT
COUNT(1)
FROM role r
INNER JOIN user_role ur ON r.id = ur.role_id
WHERE r.delflag = 0 AND user_id = #{userId, jdbcType=BIGINT} AND role_sign = #{roleSign, jdbcType=VARCHAR}
</select>
<!--<select id="getRoleByIds" resultMap="BaseResultMap" parameterType="string">-->
<!--SELECT r.* FROM role r where delflag= 0-->
......
......@@ -8,9 +8,9 @@ import java.util.List;
/**
* 角色模型
*
**/
public class Role extends BasicEntity{
public class Role extends BasicEntity {
private Long id;
private String roleName;
......@@ -43,7 +43,6 @@ public class Role extends BasicEntity{
return StringUtils.join(getMenuIdList(), ",");
}
public List<Permission> getPermission() {
return permission;
}
......@@ -92,5 +91,4 @@ public class Role extends BasicEntity{
}
}
\ No newline at end of file
......@@ -50,4 +50,11 @@ public interface RoleService{
*/
List<Role> selectAllSign(String roleSign);
/**
* 通过人员id,角色签名查询用户是否包含角色
* @param id
* @param systemLeader
* @return
*/
boolean selectRoleEntityByUserId(Long id, String systemLeader);
}
......@@ -16,7 +16,6 @@ import java.util.Map;
/**
* @author lisw
* @date 2016年9月20日 下午1:57:21
*
*/
@Service
public class RoleServiceImpl implements RoleService {
......@@ -24,10 +23,6 @@ public class RoleServiceImpl implements RoleService {
@Resource
private RoleMapper roleMapper;
@Override
public List<UserRole> selectRolesByUserId(Long userId) {
return roleMapper.selectRolesByUserId(userId);
......@@ -57,13 +52,11 @@ public class RoleServiceImpl implements RoleService {
@Override
public void updateRole(Role r)
{
public void updateRole(Role r) {
roleMapper.updateRole(r);
//删除所有的ROLE
roleMapper.deleteRolePermission(r.getId());
if(r.getPermission().size()>0)
{
if (r.getPermission().size() > 0) {
roleMapper.insertRolePermission(r);
}
}
......@@ -73,7 +66,7 @@ public class RoleServiceImpl implements RoleService {
List<Long> ids = Lists.newArrayList();
String[] roles = roleids.split(",");
for (String role:roles) {
for (String role : roles) {
ids.add(Long.valueOf(role));
}
RoleExample example = new RoleExample();
......@@ -93,15 +86,23 @@ public class RoleServiceImpl implements RoleService {
@Override
public List<UserRole> selectRolesByUserAccountsId(Long userId,
Long accountsId) {
Map<String,Object> params = new HashMap<String, Object>();
params.put("userId",userId);
params.put("accountsId",accountsId);
Map<String, Object> params = new HashMap<String, Object>();
params.put("userId", userId);
params.put("accountsId", accountsId);
return roleMapper.selectRolesByUserAccountsId(params);
}
public List<Role> selectAllSign(String roleSign){
public List<Role> selectAllSign(String roleSign) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("roleSign", roleSign);
return roleMapper.selectAllSign(params);
}
@Override
public boolean selectRoleEntityByUserId(Long id, String systemLeader) {
Map<String, Object> params = new HashMap<>();
params.put("userId", id);
params.put("roleSign", systemLeader);
return roleMapper.selectRoleEntityByUserId(params) > 0;
}
}
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