Commit efba531b authored by 谢希宇's avatar 谢希宇

Submit by Strive

Date 2021/03/24
Project End
parent 36a9bb9d
......@@ -348,7 +348,7 @@ public class ConsultSheetController {
consultSheetVO.setSex(consultSheetObj.getSex() == 1 ? "男" : "女");
consultSheetVO.setPhone( tpl.append(consultSheetObj.getPhone()).replace(3,7, "****").toString());
tpl.setLength(0);
consultSheetVO.setIsThree(consultSheetObj.getIsThree().equals("1")? "是":"否");
consultSheetVO.setIsThree(StringUtils.equals(consultSheetVO.getIsThree(), "0")? "三期患者":(StringUtils.equals(consultSheetVO.getIsThree(), "1") ? "四期患者":""));
consultSheetVO.setStatus("0".equals(consultSheetObj.getStatus()) ? "未审核" : "1".equals(consultSheetObj.getStatus()) ? "已通过" : "已拒绝");
consultSheetVO.setPharmaName(consultSheetObj.getPharmaName());
consultSheetVO.setCustomerName(consultSheetObj.getCustomerName());
......
......@@ -67,6 +67,8 @@ public class Couponrecord implements Serializable {
private Date createTime;
/* 更新时间 */
private Date updateTime;
private Date endTime;
/* 备注 */
private String description;
/* 创建人 */
......
......@@ -8,6 +8,7 @@ import com.cftech.checkcoupon.utils.QrcodeUtil;
import com.cftech.core.scope.OrderType;
import com.cftech.core.sql.Sort;
import com.cftech.core.util.Constants;
import com.cftech.core.util.DateFormatUtils;
import com.cftech.core.util.StringUtils;
import com.cftech.core.util.SystemConfig;
import com.cftech.couponrecord.model.Couponrecord;
......@@ -18,7 +19,6 @@ import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
import com.cftech.core.sql.Conds;
import com.google.zxing.WriterException;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
......@@ -108,9 +108,17 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
}
} else {
Couponrecord lastCouponrecord = findCouponrecordBySort(null, openid).get(0);//获取最后一张券
if (StringUtils.equals(lastCouponrecord.getType(), "2")) {
//获取最后一张券失效时间购买数量
number = buyingMedicineNumber(openid, lastCouponrecord.getCreateTime());
//如果最后一张券为第二章 判断是否发券年限
if (StringUtils.equals(lastCouponrecord.getType(), "2") &&
Integer.parseInt(lastCouponrecord.getTakeEffectYear()) < Integer.parseInt(checkcoupon.getTakeEffectYear())) {
//获取最后第一张券,活动周期一年后算数量
Couponrecord beforeCouponrecord = findCouponrecordBySort("1", openid).get(0);
Calendar calendar = Calendar.getInstance();
calendar.setTime(beforeCouponrecord.getCreateTime());
calendar.add(Calendar.YEAR, 1);
number = buyingMedicineNumber(openid, calendar.getTime());
if (number >= 3) {//赠送第一张
String no = codingruleUtils.getPrimaryKey(CodingruleUtils.COUPON_KEY);
......@@ -153,7 +161,7 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
}
} else if (StringUtils.equals(lastCouponrecord.getType(), "1")) {//通过第一张开始时间获取购买数量
List<Couponrecord> lastCouponrecordList = findCouponrecordBySort("2", openid);
if (lastCouponrecordList == null || lastCouponrecordList.size() == 0) {
if (lastCouponrecordList == null || lastCouponrecordList.size() == 0) {//第一次
Calendar calendar = Calendar.getInstance();
calendar.setTime(lastCouponrecord.getCreateTime());
calendar.set(Calendar.MONTH, 0);
......@@ -161,10 +169,16 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
calendar.set(Calendar.HOUR_OF_DAY, 1);
calendar.set(Calendar.MINUTE, 1);
number = buyingMedicineNumber(openid, calendar.getTime());//获取最后一张券购买数量
} else {
number = buyingMedicineNumber(openid, lastCouponrecordList.get(0).getCreateTime());//获取最后一张券购买数量
} else {//第二次购买
//获取倒数2张类型1的券
List<Couponrecord> firstCouponrecordList = findCouponrecordBySort("1", openid);
if (firstCouponrecordList != null && firstCouponrecordList .size() >= 2) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(firstCouponrecordList.get(1).getCreateTime());
calendar.add(Calendar.YEAR, 1);
number = buyingMedicineNumber(openid, calendar.getTime());//
}
}
//通过第一张最后购买数量,所以只需赠送第二章
if (number >= 6) {//赠送第二张
......@@ -211,7 +225,7 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
conds.equal("t.openid", openid);
conds.equal("d.drugs_id", SystemConfig.p.getProperty("THREE_DRUGS_ID"));
if (date != null) {
conds.greatEqual("t.pay_time", date);
conds.greatEqual("DATE_FORMAT(t.pay_time,'%Y-%m-%d')", DateFormatUtils.getDateFormat(date, "yyyy-MM-dd"));
} else {
Calendar calendar = Calendar.getInstance();
conds.equal("DATE_FORMAT(t.pay_time, '%Y')", calendar.get(Calendar.YEAR));
......@@ -244,7 +258,7 @@ public class CouponrecordServiceImpl extends GenericServiceImpl<Couponrecord> im
conds.equal("t.type", type);
if (StringUtils.isNoneBlank(openid))
conds.equal("t.openid", openid);
Sort sort = new Sort("t.create_time", OrderType.DESC);
Sort sort = new Sort("t.expire_date", OrderType.DESC);
Map<String, Object> params = new HashMap<>();
params.put("conds", conds);
params.put("sort", sort);
......
......@@ -76,8 +76,7 @@
<div class="col-xs-12">
<div class="box">
<div class="box-header">
<form id="seachTableForm" action="#springUrl('/a/outReport/list')" method="get">
<form id="seachTableForm" action="#springUrl('/a/outReport/exportExcel')" method="get">
<div class="col-xs-2">
<input type="text" class="form-control"
......@@ -89,7 +88,6 @@
name="orderCode" placeholder="需求清单编码">
</div>
<div class="col-xs-5">
<button type="button" class="search btn btn-primary">搜索</button>
#if($shiro.hasPermission("qy:outReport:edit"))
......
package com.cftech.report.dao;
import com.cftech.report.model.Report;
import com.cftech.report.model.*;
import com.cftech.core.generic.GenericDao;
import com.cftech.report.model.ReportCode;
import com.cftech.report.model.ReportDoctorInfo;
import com.cftech.report.model.ReportPeopleInfo;
import java.util.List;
import java.util.Map;
......@@ -43,7 +40,7 @@ public interface ReportMapper extends GenericDao<Report> {
* @param params
* @return
*/
List<Report> fetchSearchByPageOutReport(Map<String, Object> params);
List<OutStoreReport> fetchSearchByPageOutReport(Map<String, Object> params);
/**
* 订单出库报表统计
......
package com.cftech.report.model;
import com.cftech.core.poi.ExportConfig;
import lombok.Data;
import java.util.Date;
/**
* 订单出库报表实体类
*/
......@@ -11,26 +14,34 @@ public class OutStoreReport {
private String id;
/* 咨询单编码 */
@ExportConfig(value = "咨询单编码", width = 120, showLevel = 1)
private String consultCode;
/* 需求清单编码 */
@ExportConfig(value = "需求清单编码", width = 120, showLevel = 1)
private String orderCode;
/* 药品名称 */
@ExportConfig(value = "药品名称", width = 120, showLevel = 1)
private String drugName;
/* 药品Sku */
@ExportConfig(value = "规格", width = 100, showLevel = 1)
private String grugSku;
/* 药品数量 */
@ExportConfig(value = "药品数量", width = 100, showLevel = 1)
private String drugNum;
/* 药品批次号 */
@ExportConfig(value = "药品批次号", width = 100, showLevel = 1)
private String drugBatchNo;
/* 出库时间 */
private String outStoreDate;
@ExportConfig(value = "出库时间", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd HH:mm")
private Date outStoreDate;
/* 有效期 */
//@ExportConfig(value = "有效期", width = 100, showLevel = 1)
private String takeEffectDate;
}
......@@ -72,13 +72,13 @@ public class Report implements Serializable {
@ExportConfig(value = "购买数量", width = 100, showLevel = 1)
private String drugsNum;
/* 付款时间 */
@ExportConfig(value = "付款时间", width = 100, showLevel = 1)
@ExportConfig(value = "付款时间", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd HH:mm")
private Date fkTime;
/* 发货时间 */
@ExportConfig(value = "发货时间", width = 100, showLevel = 1)
@ExportConfig(value = "发货时间", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd HH:mm")
private Date fhTime;
/* 收件时间 */
@ExportConfig(value = "收件时间", width = 100, showLevel = 1)
@ExportConfig(value = "收件时间", width = 100, showLevel = 1, dateFormat = "yyyy-MM-dd HH:mm")
private Date sjTime;
/* 所属的账号 */
private Long accountsId;
......
......@@ -2,11 +2,8 @@ package com.cftech.report.service;
import com.cftech.core.sql.Conds;
import com.cftech.core.sql.Sort;
import com.cftech.report.model.Report;
import com.cftech.report.model.*;
import com.cftech.core.generic.GenericService;
import com.cftech.report.model.ReportCode;
import com.cftech.report.model.ReportDoctorInfo;
import com.cftech.report.model.ReportPeopleInfo;
import java.util.List;
import java.util.Map;
......@@ -50,7 +47,7 @@ public interface ReportService extends GenericService<Report> {
* @param iDisplayLength
* @return
*/
List<Report> fetchSearchByPageOutReport(Conds conds, Sort sort, int iDisplayStart, int iDisplayLength);
List<OutStoreReport> fetchSearchByPageOutReport(Conds conds, Sort sort, int iDisplayStart, int iDisplayLength);
/**
* 订单出库报表统计
......
package com.cftech.report.service.impl;
import com.cftech.core.sql.Sort;
import com.cftech.report.model.Report;
import com.cftech.report.model.*;
import com.cftech.report.dao.ReportMapper;
import com.cftech.report.model.ReportCode;
import com.cftech.report.model.ReportDoctorInfo;
import com.cftech.report.model.ReportPeopleInfo;
import com.cftech.report.service.ReportService;
import com.cftech.core.generic.GenericDao;
import com.cftech.core.generic.GenericServiceImpl;
......@@ -60,7 +57,7 @@ public class ReportServiceImpl extends GenericServiceImpl<Report> implements Rep
}
@Override
public List<Report> fetchSearchByPageOutReport(Conds conds, Sort sort, int page, int pageSize) {
public List<OutStoreReport> fetchSearchByPageOutReport(Conds conds, Sort sort, int page, int pageSize) {
Map<String, Object> params = new HashMap<String, Object>();
params.put("conds", conds);
params.put("offset", page > 0 ? page : 0);
......
......@@ -6,23 +6,21 @@ 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.report.model.OutStoreReport;
import com.cftech.report.model.Report;
import com.cftech.report.service.ReportService;
import com.cftech.sys.security.UserUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
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;
......@@ -68,46 +66,23 @@ public class OutStoreReportController {
return "report/outReportform";
}
//提交数据(新增、修改)
@RequiresPermissions(value = REPORT_EDIT)
@RequestMapping("/formData")
@ResponseBody
public JSONObject formData(Report report, Model model, HttpServletRequest request) {
Long accountsId = UserUtils.getmpaccounts(request);
JSONObject rtnJson = new JSONObject();
try {
if (report != null && report.getId() != null) {
report.setUpdateBy(UserUtils.getUser().getId());
reportService.update(report);
rtnJson.put("errorNo", 0);
} else {
report.setAccountsId(accountsId);
report.setDelFlag(false);
report.setAccountsId(UserUtils.getmpaccounts(request));
report.setCreateBy(UserUtils.getUser().getId());
report.setUpdateBy(UserUtils.getUser().getId());
reportService.save(report);
rtnJson.put("errorNo", 2);
}
} catch (Exception e) {
rtnJson.put("errorNo", 1);
}
return rtnJson;
}
//获取列表数据
@RequiresPermissions(value = REPORT_VIEW)
@RequestMapping(value = "/listData")
@ResponseBody
public JSONObject listData(int iDisplayStart, int iDisplayLength, Report report, HttpServletRequest request,String startPayTime,String endPayTime) {
public JSONObject listData(int iDisplayStart, int iDisplayLength, OutStoreReport outStoreReport, HttpServletRequest request, String startPayTime, String endPayTime) {
Long accountsId = UserUtils.getmpaccounts(request);
Conds conds = new Conds();
conds.equal("sb.del_flag", Constants.DEL_FLAG_0);
//conds.equal("accounts_id", accountsId);
Sort sort = new Sort("sb.create_time", OrderType.DESC);
List<Report> list = reportService.fetchSearchByPageOutReport(conds, sort, iDisplayStart, iDisplayLength);
conds.equal("sb.accounts_id", accountsId);
Sort sort = new Sort("w.create_time", OrderType.DESC);
if (StringUtils.isNoneBlank(outStoreReport.getConsultCode())) {
conds.equal("cs.consult_id", outStoreReport.getConsultCode());
}
if (StringUtils.isNoneBlank(outStoreReport.getOrderCode())) {
conds.equal("o.number", outStoreReport.getOrderCode());
}
List<OutStoreReport> list = reportService.fetchSearchByPageOutReport(conds, sort, iDisplayStart, iDisplayLength);
Integer counts = reportService.countOutReport(conds);
JSONObject rtnJson = new JSONObject();
rtnJson.put("iTotalRecords", counts);
......@@ -116,103 +91,22 @@ public class OutStoreReportController {
return rtnJson;
}
//删除数据
@RequiresPermissions(value = REPORT_EDIT)
@RequestMapping("/delete")
@ResponseBody
public JSONObject delete(String id) {
JSONObject rtnJosn = new JSONObject();
try {
reportService.delete(id);
rtnJosn.put("errorNo", 0);
} catch (Exception e) {
rtnJosn.put("errorNo", 1);
}
return rtnJosn;
}
@RequestMapping("/exportExcel")
@RequiresPermissions(value = REPORT_VIEW)
public void exportExcel(Report report, HttpServletRequest request,String startPayTime,String endPayTime, HttpServletResponse response) {
public void exportExcel(HttpServletRequest request, OutStoreReport outStoreReport, HttpServletResponse response) {
Long accountId = UserUtils.getmpaccounts(request);
Sort sort = new Sort("create_time", OrderType.ASC);
Conds conds = new Conds();
conds.equal("del_flag", 0);
if(!StringUtils.isEmpty(report.getRegion())){
conds.like("region",report.getRegion());
}
if(!StringUtils.isEmpty(report.getProvince())){
conds.like("province",report.getProvince());
}
if(!StringUtils.isEmpty(report.getCity())){
conds.like("city",report.getCity());
}
if(!StringUtils.isEmpty(report.getHospital())){
conds.like("hospital",report.getHospital());
}
if(!StringUtils.isEmpty(report.getDoctorName())){
conds.like("doctor_name",report.getDoctorName());
}
if(!StringUtils.isEmpty(report.getPhone())){
conds.like("phone",report.getPhone());
}
if(!StringUtils.isEmpty(report.getDrugsNum())){
conds.equal("drugs_num",report.getDrugsNum());
}
if(!StringUtils.isEmpty(startPayTime)){
conds.greatEqual("DATE_FORMAT(fk_time,'%Y-%m-%d')",startPayTime);
}
if(!StringUtils.isEmpty(endPayTime)){
conds.lessEqual("DATE_FORMAT(fk_time,'%Y-%m-%d')",endPayTime);
}
List<Report> list = reportService.fetchSearchByPage(conds, sort, 0, 0);
ExcelKit.$Export(Report.class, response).toExcel(list, "报表信息信息");
}
@RequestMapping("/templateExcel")
@RequiresPermissions(value = REPORT_VIEW)
public void templateExcel(HttpServletRequest request, HttpServletResponse response) {
ExcelKit.$Export(Report.class, response).toExcel(null, "报表信息信息");
}
@RequestMapping("/importExcel")
@RequiresPermissions(value = REPORT_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))) {
Report report = new Report();
report.setAccountsId(accountId);
reportService.save(report);
conds.equal("sb.del_flag", Constants.DEL_FLAG_0);
conds.equal("sb.accounts_id", accountId);
Sort sort = new Sort("w.create_time", OrderType.DESC);
if (StringUtils.isNoneBlank(outStoreReport.getConsultCode())) {
conds.equal("cs.consult_id", outStoreReport.getConsultCode());
}
});
} catch (IOException e) {
log.error(e.getMessage());
if (StringUtils.isNoneBlank(outStoreReport.getOrderCode())) {
conds.equal("o.number", outStoreReport.getOrderCode());
}
return list(request, model);
List<OutStoreReport> list = reportService.fetchSearchByPageOutReport(conds, sort, 0, 0);
ExcelKit.$Export(OutStoreReport.class, response).toExcel(list, "出库报表信息信息");
}
}
......@@ -193,6 +193,7 @@ public class WaybillServiceImpl extends GenericServiceImpl<Waybill> implements W
JSONObject drugs = arr.getJSONObject(i);
OrderSplitBatchDto orderSplitBatchDto = new OrderSplitBatchDto();
orderSplitBatchDto.setOrderId(order.getId());
orderSplitBatchDto.setAccountsId(accountsId);
orderSplitBatchDto.setOrderCode(order.getNumber());
orderSplitBatchDto.setDrugsBatchNo(drugs.getString("batchNo"));
orderSplitBatchDto.setDrugsId(drugs.getLong("drugId"));
......@@ -200,7 +201,6 @@ public class WaybillServiceImpl extends GenericServiceImpl<Waybill> implements W
orderSplitBatchDto.setDrugsCode(drugs.getString("drugCode"));
orderSplitBatchDto.setDrugsNum(drugs.getLong("num"));
orderSplitBatchDto.setOpenid(order.getOpenid());
orderDetailsService.saveDrugBatchNo(orderSplitBatchDto);
}
......@@ -224,7 +224,6 @@ public class WaybillServiceImpl extends GenericServiceImpl<Waybill> implements W
} finally {
log.info("调用丰桥接口:订单编码 {}" + orderId );
}
return retObj;
}
......
......@@ -295,7 +295,7 @@
btnoktext: "继续添加",
btncanceltext: "关闭",
success: function () {
location.href = "#springUrl('/a/orgunit/form')";
location.href = "#springUrl('/a/orgunit/form')?parentId="+$('input[name="parentId"]').val();
},
cancel: function () {
location.href = "#springUrl('/a/orgunit/list')";
......
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