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);
}
}
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 热门推荐
* @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 好药推荐
* @Description 好药推荐
* @Date 19:42 2020/11/2
* @Param [appId]
* @return com.alibaba.fastjson.JSONObject
**/
List<ProductVO> medicine();
/**
* 根据分类编码查分类ID
*
* @param classifyNumber
* @return
*/
......
......@@ -213,21 +213,22 @@
</update>
<select id="productList" resultType="com.cftech.productclassify.model.ProductclassifyVO">
SELECT
t.id AS ID,
t.product_name AS productName,
t.classify_id AS classifyId,
t.product_img AS productImg,
t.dosaga_from AS dosagaFrom,
t.common_name AS commonName,
t.format,
t.product_number AS productNumber,
t.accounts_id AS accountsId,
t.is_rs AS isRs,
SELECT
t.id AS ID,
t.product_name AS productName,
t.classify_id AS classifyId,
t.product_img AS productImg,
t.dosaga_from AS dosagaFrom,
t.common_name AS commonName,
t.format,
t.product_number AS productNumber,
t.accounts_id AS accountsId,
t.is_rs AS isRs,
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!=''">
......
......@@ -9,10 +9,11 @@ import lombok.Data;
*/
@Data
public class ProductclassifyDto {
private String productName;
private Long classifyName;
private String dosagaFrom;
private String appId;
private Long page;
private Long pageSize;
private String productName;
private Long classifyName;
private String dosagaFrom;
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){
e.printStackTrace();
rtnJson.put("errorNo","1");
} catch (Exception e) {
e.printStackTrace();
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 商品列表展示
* @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 商品分类菜单数据回填
* @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 商品分类菜单剂型回填
* @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
* @Param
**/
@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
......@@ -104,7 +104,7 @@ APP_SECRET=SD25624CC1DF4AB7
KAIHUHANG_ADDRESS=\u6C5F\u82CF\u94F6\u884C\u626C\u5DDE\u5510\u57CE\u652F\u884C 90160188000128434
CLERK=\u5415\u5029
CHECKER=\u7530\u59DD
PAYEE=\u6C6A\u8A00\u52C7
PAYEE=\u6C6A\u8A00\u52C7
#\u5F00\u53D1\u7968\u63A5\u53E3
INVOICE_API=nuonuo.ElectronInvoice.requestBillingNew
#\u67E5\u8BE2\u53D1\u7968\u63A5\u53E3
......@@ -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,
......
......@@ -11,7 +11,13 @@ public class Constants {
* 后台用户登录Session key
*/
public static final String VALUE_SESSION_KEY="sysUser";
/**
* 药店主管角色标识
*/
public static final String SYSTEM_LEADER = "sys:leader";
public static final String SYSTEM_STORAGEMANAGER= "sys:storageManager";
/*
* 删除状态(未删除)
......@@ -21,6 +27,10 @@ public class Constants {
* 删除状态(已删除)
*/
public static final String DEL_FLAG_1 = "1";
public static final String TRUE = "1";
public static final String FALSE = "0";
/*
* 会员编号
......
......@@ -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
......@@ -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;
}
......@@ -14,13 +14,13 @@ import java.util.Date;
public class MemberVO {
/*appid*/
private String appId;
private String appId;
private Long id;
private Long id;
/*姓名*/
private String memberName;
private String memberName;
/*性别*/
private String sex;
private String sex;
/*生日*/
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date birthday;
......@@ -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
......
......@@ -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);
......
......@@ -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);
......@@ -25,7 +26,7 @@ public interface RoleMapper{
List<Role> selectByExample(RoleExample example);
Role selectByPrimaryKey(Long id);
Role getByPrimaryKey(Long id);
int updateByExampleSelective(@Param("record") Role record, @Param("example") RoleExample example);
......@@ -35,45 +36,49 @@ public interface RoleMapper{
int updateByPrimaryKeySelective(Role record);
int updateByPrimaryKey(Role record);
List<Role> selectAll(Map<String, Object> params);
/**
* 通过用户id 查询用户 拥有的角色
*
*
* @param userId
* @return
*/
List<UserRole> selectRolesByUserId(Long userId);
int insertRole(Role record);
int deleteRolePermission(Long roleid);
int insertRolePermission(Role role);
int updateRole(Role role);
//List<Role> getRoleByIds(String ids);
/**
* 通过用户id,公众号ID 查询拥有的角色
*
* @return
*/
List<UserRole> selectRolesByUserAccountsId(Map<String, Object> params);
/**
* 通过公众号ID查询拥有的角色
*
*
* @param userId
* @return
*/
List<UserRole> selectRolesByAccountsId(Long userId);
/**
* 通过角色编码
*
* @param params
* @return
*/
List<Role> selectAllSign(Map<String, Object> params);
Integer selectRoleEntityByUserId(Map<String, Object> params);
}
\ No newline at end of file
......@@ -4,16 +4,14 @@
<resultMap id="roleResult" type="com.cftech.sys.model.Role">
<id property="id" column="id" />
<result column="role_name" property="roleName" jdbcType="VARCHAR" />
<result column="role_name" property="roleName" jdbcType="VARCHAR" />
<result column="role_sign" property="roleSign" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
<result column="description" property="description" jdbcType="VARCHAR" />
<collection property="permission" ofType="com.cftech.sys.model.Permission">
<id property="id" column="permission.id" />
</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" />
......@@ -33,11 +31,10 @@
LEFT JOIN role_permission rm ON rm.role_id = a.id
WHERE a.id = #{id}
</select>
<select id="selectAll" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
<include refid="Base_Column_List" />
<include refid="Base_Column_List" />
FROM role
where delflag = 0
<if test="roleName!=null">
......@@ -47,7 +44,7 @@
<select id="selectAllSign" resultMap="BaseResultMap" parameterType="java.util.Map">
SELECT
<include refid="Base_Column_List" />
<include refid="Base_Column_List" />
FROM role
where delflag = 0
<if test="roleSign!=null">
......@@ -55,13 +52,7 @@
</if>
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)
......@@ -160,7 +158,7 @@
#{description,jdbcType=VARCHAR})
</insert>
<insert id="insertRole" useGeneratedKeys="true" keyProperty="id" parameterType="com.cftech.sys.model.Role">
<insert id="insertRole" useGeneratedKeys="true" keyProperty="id" parameterType="com.cftech.sys.model.Role">
insert into role
<trim prefix="(" suffix=")" suffixOverrides=",">
......@@ -194,7 +192,7 @@
</trim>
</insert>
<delete id="deleteRolePermission">
<delete id="deleteRolePermission">
DELETE FROM role_permission WHERE role_id = #{id}
</delete>
......@@ -205,9 +203,7 @@
FROM dual
</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>
......@@ -268,12 +266,11 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateRole" parameterType="com.cftech.sys.model.Role">
update role
<update id="updateRole" parameterType="com.cftech.sys.model.Role">
update role
<set>
<if test="roleName != null">
<if test="roleName != null">
role_name = #{roleName,jdbcType=VARCHAR},
</if>
<if test="roleSign != null">
......@@ -285,14 +282,11 @@
<if test="description != null">
description = #{description,jdbcType=VARCHAR},
</if>
updatetime = #{updatetime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=BIGINT}
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},
......@@ -346,7 +342,15 @@
<select id="selectRolesByAccountsId" resultType="com.cftech.sys.model.UserRole" parameterType="java.lang.Long">
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-->
......
......@@ -49,5 +49,12 @@ public interface RoleService{
*通过角色编码,搜索出对应角色
*/
List<Role> selectAllSign(String roleSign);
/**
* 通过人员id,角色签名查询用户是否包含角色
* @param id
* @param systemLeader
* @return
*/
boolean selectRoleEntityByUserId(Long id, String systemLeader);
}
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