Commit 37808869 by 邹磊浩

修改代码

parent 0d3813e8
...@@ -3,6 +3,7 @@ package com.pz.web.controller.system; ...@@ -3,6 +3,7 @@ package com.pz.web.controller.system;
import java.util.List; import java.util.List;
import java.util.Arrays; import java.util.Arrays;
import cn.hutool.core.util.RandomUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.*; import javax.validation.constraints.*;
......
...@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
...@@ -103,24 +104,24 @@ public class InsertTestOrderTask { ...@@ -103,24 +104,24 @@ public class InsertTestOrderTask {
List<Employees> employees = employeesMapper.selectList(Wrappers.<Employees>lambdaQuery().eq(Employees::getCompanyId, company.getId()).last("limit 10")); List<Employees> employees = employeesMapper.selectList(Wrappers.<Employees>lambdaQuery().eq(Employees::getCompanyId, company.getId()).last("limit 10"));
Employees element = getRandomElement(employees); Employees element = getRandomElement(employees);
executorService.submit(() -> { executorService.submit(() -> {
// 每日单量 // 每日单量
Integer num = orderNumMap.get(company.getId()); Integer num = orderNumMap.get(company.getId());
for (int i = 0; i <= num; i++) { for (int i = 0; i <= num; i++) {
//接单人员 //接单人员
UserVsitor vsitor = getRandomElement(userVsitors); UserVsitor vsitor = getRandomElement(userVsitors);
//随机业务 //随机业务
Integer businessId = getRandomElement(businessIds); Integer businessId = getRandomElement(businessIds);
//获取服务价格 //获取服务价格
List<Services> services = servicesMapper.selectList(Wrappers.<Services>lambdaQuery().eq(Services::getBid, businessId).eq(Services::getCityId, company.getCityId())); List<Services> services = servicesMapper.selectList(Wrappers.<Services>lambdaQuery().eq(Services::getBid, businessId).eq(Services::getCityId, company.getCityId()));
//随机服务 //随机服务
Services service = getRandomElement(services); Services service = getRandomElement(services);
Long orderId = saveTotalOrder(businessId, element.getId(), company.getCityId().intValue(), company.getId(), service); Long orderId = saveTotalOrder(businessId, element.getId(), company.getCityId().intValue(), company.getId(), service);
List<Hospital> hospitals = hospitalMapper.selectList(Wrappers.<Hospital>lambdaQuery().eq(Hospital::getCityId, company.getCityId()).last("limit 50")); List<Hospital> hospitals = hospitalMapper.selectList(Wrappers.<Hospital>lambdaQuery().eq(Hospital::getCityId, company.getCityId()).last("limit 50"));
//随机医院 //随机医院
Hospital hospital = getRandomElement(hospitals); Hospital hospital = getRandomElement(hospitals);
//新增业务 //新增业务
randomOrder(businessId, orderId.intValue(), 2, hospital.getId(), vsitor.getId(), element); randomOrder(businessId, orderId.intValue(), 2, hospital.getId(), vsitor.getId(), element);
} }
}); });
} }
executorService.shutdown(); executorService.shutdown();
...@@ -187,6 +188,11 @@ public class InsertTestOrderTask { ...@@ -187,6 +188,11 @@ public class InsertTestOrderTask {
zyphOrder.setHid(hid); zyphOrder.setHid(hid);
zyphOrder.setStatus(status); zyphOrder.setStatus(status);
zyphOrder.setVisitor(vid); zyphOrder.setVisitor(vid);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String formattedDate = sdf.format(date);
String format = sdf.format(dateStr);
zyphOrder.setStartDay(formattedDate);
zyphOrder.setEndDay(format);
zyphOrder.setOverTime(dateStr); zyphOrder.setOverTime(dateStr);
zyphOrder.setCreateTime(date); zyphOrder.setCreateTime(date);
zyphOrderMapper.insert(zyphOrder); zyphOrderMapper.insert(zyphOrder);
...@@ -200,6 +206,7 @@ public class InsertTestOrderTask { ...@@ -200,6 +206,7 @@ public class InsertTestOrderTask {
dbmyOrder.setPzShr(element.getName()); dbmyOrder.setPzShr(element.getName());
dbmyOrder.setPzShPhone(element.getPhone()); dbmyOrder.setPzShPhone(element.getPhone());
dbmyOrder.setCreateTime(date); dbmyOrder.setCreateTime(date);
dbmyOrder.setIsRefrigerate(RandomUtil.randomInt(0, 2));
dbmyOrderMapper.insert(dbmyOrder); dbmyOrderMapper.insert(dbmyOrder);
break; break;
case 6: case 6:
...@@ -217,6 +224,7 @@ public class InsertTestOrderTask { ...@@ -217,6 +224,7 @@ public class InsertTestOrderTask {
} }
} }
public Date randomTime() { public Date randomTime() {
Calendar calendar = new GregorianCalendar(); Calendar calendar = new GregorianCalendar();
calendar.set(Calendar.HOUR_OF_DAY, 9); // 设置开始时间为早上9点 calendar.set(Calendar.HOUR_OF_DAY, 9); // 设置开始时间为早上9点
...@@ -265,13 +273,9 @@ public class InsertTestOrderTask { ...@@ -265,13 +273,9 @@ public class InsertTestOrderTask {
employeesDivide.setOrderId(totalOrder.getId().intValue()); employeesDivide.setOrderId(totalOrder.getId().intValue());
employeesDivide.setOrderPrice(totalOrder.getPayMoney() + ""); employeesDivide.setOrderPrice(totalOrder.getPayMoney() + "");
double money = 0; double money = 0;
if (services.getFenmo() == 0) { double fenmo = (double) 20 / 100;
money = totalOrder.getPayMoney(); double v = totalOrder.getPayMoney() * fenmo;
} else if (services.getFenmo() != 0) { money = totalOrder.getPayMoney() - v;
double fenmo = (double) services.getFenmo() / 100;
double v = totalOrder.getPayMoney() * fenmo;
money = totalOrder.getPayMoney() - v;
}
Company company = companyMapper.selectById(companyId); Company company = companyMapper.selectById(companyId);
company.setTotalRevenue((Double.parseDouble(company.getTotalRevenue()) + money) + ""); company.setTotalRevenue((Double.parseDouble(company.getTotalRevenue()) + money) + "");
......
...@@ -75,4 +75,13 @@ public class DbghOrderBo extends BaseEntity { ...@@ -75,4 +75,13 @@ public class DbghOrderBo extends BaseEntity {
private Long userId; private Long userId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
} }
...@@ -122,4 +122,14 @@ public class DbmyOrderBo extends BaseEntity { ...@@ -122,4 +122,14 @@ public class DbmyOrderBo extends BaseEntity {
private String orderSn; private String orderSn;
private Long userId; private Long userId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
} }
...@@ -107,4 +107,14 @@ public class DbwzOrderBo extends BaseEntity { ...@@ -107,4 +107,14 @@ public class DbwzOrderBo extends BaseEntity {
private String orderSn; private String orderSn;
private Long userId; private Long userId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
} }
...@@ -80,4 +80,14 @@ public class YypzOrderBo extends BaseEntity { ...@@ -80,4 +80,14 @@ public class YypzOrderBo extends BaseEntity {
private String remark; private String remark;
private Long userId; private Long userId;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
} }
...@@ -83,4 +83,14 @@ public class ZqghOrderBo extends BaseEntity { ...@@ -83,4 +83,14 @@ public class ZqghOrderBo extends BaseEntity {
* 预约时间段 * 预约时间段
*/ */
private List<String> timeOfAppointmentArr; private List<String> timeOfAppointmentArr;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
} }
...@@ -86,4 +86,5 @@ public class ZyphOrderBo extends BaseEntity { ...@@ -86,4 +86,5 @@ public class ZyphOrderBo extends BaseEntity {
private String orderSn; private String orderSn;
private Long userId; private Long userId;
} }
...@@ -177,5 +177,7 @@ public class DbmyOrderVo { ...@@ -177,5 +177,7 @@ public class DbmyOrderVo {
private String isSatisfaction; private String isSatisfaction;
private Date createTime;
private String evaluationContent; private String evaluationContent;
} }
...@@ -55,6 +55,9 @@ ...@@ -55,6 +55,9 @@
<if test="bo.userId != null"> <if test="bo.userId != null">
and co.uid = #{bo.userId} and co.uid = #{bo.userId}
</if> </if>
<if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''">
and yyod.create_time &gt; = #{bo.startTime} and yyod.create_time &lt; = #{bo.endTime}
</if>
</where> </where>
order by yyod.visit_time desc order by yyod.visit_time desc
</select> </select>
......
...@@ -43,8 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -43,8 +43,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
tlo.`status` AS tStatus, tlo.`status` AS tStatus,
tlo.is_satisfaction AS isSatisfaction, tlo.is_satisfaction AS isSatisfaction,
tlo.evaluation_content AS evaluationContent, tlo.evaluation_content AS evaluationContent,
yyod.* yyod.createTime as createTime
FROM FROM
dbmy_order AS yyod dbmy_order AS yyod
LEFT JOIN total_order AS tlo ON yyod.order_id = tlo.id LEFT JOIN total_order AS tlo ON yyod.order_id = tlo.id
LEFT JOIN city AS c ON c.id = tlo.city_id LEFT JOIN city AS c ON c.id = tlo.city_id
...@@ -58,6 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -58,6 +58,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bo.userId != null"> <if test="bo.userId != null">
and co.uid = #{bo.userId} and co.uid = #{bo.userId}
</if> </if>
<if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''">
and yyod.create_time &gt; = #{bo.startTime} and yyod.create_time &lt; = #{bo.endTime}
</if>
</where> </where>
order by tlo.create_time desc order by tlo.create_time desc
</select> </select>
......
...@@ -59,6 +59,9 @@ ...@@ -59,6 +59,9 @@
<if test="bo.userId != null"> <if test="bo.userId != null">
and co.uid = #{bo.userId} and co.uid = #{bo.userId}
</if> </if>
<if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''">
and yyod.create_time &gt; = #{bo.startTime} and yyod.create_time &lt; = #{bo.endTime}
</if>
</where> </where>
order by yyod.visit_time desc order by yyod.visit_time desc
</select> </select>
......
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.pz.system.mapper.YypzOrderMapper"> <mapper namespace="com.pz.system.mapper.YypzOrderMapper">
<resultMap type="com.pz.system.domain.YypzOrder" id="YypzOrderResult"> <resultMap type="com.pz.system.domain.YypzOrder" id="YypzOrderResult">
...@@ -24,32 +24,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -24,32 +24,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<select id="findYypzOrderVoPage" resultType="com.pz.system.domain.vo.YypzOrderVo"> <select id="findYypzOrderVoPage" resultType="com.pz.system.domain.vo.YypzOrderVo">
SELECT SELECT
tlo.order_sn AS orderSn, tlo.order_sn AS orderSn,
tlo.pay_money AS PayMoney, tlo.pay_money AS PayMoney,
s.`name` AS serviceName, s.`name` AS serviceName,
c.`name` AS cityName, c.`name` AS cityName,
h.`name` AS hName, h.`name` AS hName,
d.title AS title, d.title AS title,
e.`name` AS eName, e.`name` AS eName,
tlo.remark AS remark, tlo.remark AS remark,
yyod.visit_time AS visitTime, yyod.visit_time AS visitTime,
yyod.phone AS phone, yyod.phone AS phone,
yyod.`status` AS yStatus, yyod.`status` AS yStatus,
tlo.`status` AS tStatus, tlo.`status` AS tStatus,
tlo.is_satisfaction AS isSatisfaction, tlo.is_satisfaction AS isSatisfaction,
tlo.evaluation_content AS evaluationContent, tlo.evaluation_content AS evaluationContent,
yyod.over_time AS overtime, yyod.over_time AS overtime,
yyod.voucher AS voucher, yyod.voucher AS voucher,
yyod.create_time as createTime, yyod.create_time as createTime,
yyod.visitor as visitor yyod.visitor as visitor
FROM yypz_order AS yyod FROM yypz_order AS yyod
LEFT JOIN total_order AS tlo ON yyod.order_id = tlo.id LEFT JOIN total_order AS tlo ON yyod.order_id = tlo.id
LEFT JOIN city AS c ON c.id = tlo.city_id LEFT JOIN city AS c ON c.id = tlo.city_id
LEFT JOIN hospital AS h ON h.id = yyod.hid LEFT JOIN hospital AS h ON h.id = yyod.hid
LEFT JOIN department AS d ON d.id = yyod.did LEFT JOIN department AS d ON d.id = yyod.did
LEFT JOIN services AS s ON s.id = tlo.service_id LEFT JOIN services AS s ON s.id = tlo.service_id
LEFT JOIN employees AS e ON e.id = tlo.em_id LEFT JOIN employees AS e ON e.id = tlo.em_id
LEFT JOIN company AS co ON co.id = e.company_id LEFT JOIN company AS co ON co.id = e.company_id
<where> <where>
<if test="bo.orderSn != null and bo.orderSn != ''"> <if test="bo.orderSn != null and bo.orderSn != ''">
and tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%') and tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%')
...@@ -57,17 +57,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -57,17 +57,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bo.userId != null"> <if test="bo.userId != null">
and co.uid = #{bo.userId} and co.uid = #{bo.userId}
</if> </if>
<if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''">
and yyod.create_time &gt; = #{bo.startTime} and yyod.create_time &lt; = #{bo.endTime}
</if>
</where> </where>
order by yyod.visit_time desc order by yyod.visit_time desc
</select> </select>
<select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo"> <select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo">
select vsitor.name as userName, select vsitor.name as userName,
yypz_order.status as orderStatus, yypz_order.status as orderStatus,
sys_user.avatar, sys_user.avatar,
hospital.name as hospital, hospital.name as hospital,
yypz_order.visit_time, yypz_order.visit_time,
yypz_order.id as sonOrderId yypz_order.id as sonOrderId
from yypz_order from yypz_order
left join user_vsitor as vsitor on vsitor.id = yypz_order.visitor left join user_vsitor as vsitor on vsitor.id = yypz_order.visitor
left join sys_user on sys_user.user_id = vsitor.uid left join sys_user on sys_user.user_id = vsitor.uid
...@@ -76,27 +79,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -76,27 +79,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectYypzOrderDetailDataByTotalId" resultType="com.pz.system.domain.vo.YypzOrderItemVo"> <select id="selectYypzOrderDetailDataByTotalId" resultType="com.pz.system.domain.vo.YypzOrderItemVo">
select total_order.id as orderId, select total_order.id as orderId,
yypz_order.id as serviceOrderId, yypz_order.id as serviceOrderId,
total_order.business_id, total_order.business_id,
total_order.status as orderStatus, total_order.status as orderStatus,
yypz_order.status as serviceStatus, yypz_order.status as serviceStatus,
yypz_order.phone, yypz_order.phone,
yypz_order.visit_time, yypz_order.visit_time,
services.name as project, services.name as project,
business.name as businessName, business.name as businessName,
total_order.evaluation_content, total_order.evaluation_content,
total_order.is_satisfaction as evaluation_flag, total_order.is_satisfaction as evaluation_flag,
total_order.remark as description, total_order.remark as description,
yypz_order.voucher, yypz_order.voucher,
CONVERT((1 - services.fenmo / 100), decimal(10, 2)) * CONVERT((1 - services.fenmo / 100), decimal (10, 2)) *
CONVERT(services.price, decimal(10, 2)) as commission, CONVERT(services.price, decimal (10, 2)) as commission,
user_vsitor.name as userName, user_vsitor.name as userName,
hospital.name as hospital, hospital.name as hospital,
yypz_order.did_name as department, yypz_order.did_name as department,
yypz_order.remark, yypz_order.remark,
total_order.uid as userId, total_order.uid as userId,
employees.uid as euserId employees.uid as euserId
from total_order from total_order
left join business on business.id = total_order.business_id left join business on business.id = total_order.business_id
left join yypz_order on yypz_order.order_id = total_order.id left join yypz_order on yypz_order.order_id = total_order.id
...@@ -109,7 +112,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -109,7 +112,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectFinishTime" resultType="java.lang.String"> <select id="selectFinishTime" resultType="java.lang.String">
select visit_time select visit_time
from total_order t left join yypz_order d on d.order_id = t.id from total_order t
where t.id = #{id} left join yypz_order d on d.order_id = t.id
where t.id = #{id}
</select> </select>
</mapper> </mapper>
...@@ -51,6 +51,9 @@ ...@@ -51,6 +51,9 @@
<if test="bo.orderSn != null and bo.orderSn != ''"> <if test="bo.orderSn != null and bo.orderSn != ''">
where tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%') where tlo.order_sn LIKE CONCAT('%', #{bo.orderSn}, '%')
</if> </if>
<if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''">
and yyod.create_time &gt; = #{bo.startTime} and yyod.create_time &lt; = #{bo.endTime}
</if>
order by tlo.create_time desc order by tlo.create_time desc
</select> </select>
......
...@@ -61,8 +61,11 @@ ...@@ -61,8 +61,11 @@
<if test="bo.userId != null"> <if test="bo.userId != null">
and co.uid = #{bo.userId} and co.uid = #{bo.userId}
</if> </if>
<if test="bo.startTime != null and bo.startTime != '' and bo.endTime != null and bo.endTime != ''">
and yyod.create_time &gt; = #{bo.startTime} and yyod.create_time &lt; = #{bo.endTime}
</if>
</where> </where>
order by tlo.create_time desc order by yyod.create_time desc
</select> </select>
<select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo"> <select id="selectSonOrderInfoByTotalId" resultType="com.pz.merchant.domain.vo.SonOrderVo">
......
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