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

订单,订单明细,报表

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