添加接口

This commit is contained in:
yangjun 2024-06-19 21:11:16 +08:00
parent 4e1c3ef488
commit a73f959fb2
13 changed files with 294 additions and 5 deletions

View File

@ -35,6 +35,7 @@ import com.sqx.modules.utils.LonLatUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.gavaghan.geodesy.Ellipsoid;
import org.gavaghan.geodesy.GlobalCoordinates;
import org.springframework.beans.factory.annotation.Autowired;
@ -522,4 +523,63 @@ public class AppArtificerController {
}
/**
* 技师首页获取当期订单加钟订单充值订单
* @param userId 技师id
* @param page 第几页
* @param limit 每页几条
* @param orderType 类型 1当期 2加钟 3充值
* @param isSfwc 0不包含 1包含 空为全部
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@ApiOperation("技师首页获取当期订单,加钟订单,充值订单")
@GetMapping("/getOrderTypeList")
public Result getOrderTypeList(Long userId,Integer page, Integer limit,Integer orderType,Integer isSfwc,String startTime,String endTime){
if(page == null){
page = 0;
}
if(limit == null){
limit = 10;
}
if(StringUtils.isNotEmpty(endTime)){
endTime = endTime+" 23:59:59";
}else{
return Result.error("结束时间不能为空");
}
return artificerService.getOrderTypeList(userId,page,limit,orderType,isSfwc,startTime,endTime);
}
/**
* 技师确认接单
* @param ordersId 订单id
* @return
*/
@ApiOperation("技师确认接单")
@GetMapping("/jishiQueren")
public Result jishiQueren(Long ordersId){
Result result = ordersService.jishiQueren(ordersId);
return result;
}
/**
* 拒单申请
* @param ordersId 订单id
* @param refusalContent 拒单内容
* @return
*/
@ApiOperation("技师拒单申请")
@GetMapping("/jishiJdsq")
public Result jishiJdsq(Long ordersId,String refusalContent){
Orders orders = new Orders();
orders.setOrdersId(ordersId);
orders.setRefusalContent(refusalContent);
orders.setStatus(9);//拒单申请
ordersService.updateById(orders);
return Result.success("拒单申请已提交,请等待客户审核!");
}
}

View File

@ -9,6 +9,7 @@ import com.sqx.modules.artificer.entity.Artificer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -35,4 +36,11 @@ public interface ArtificerDao extends BaseMapper<Artificer> {
Integer selectArtificerMassageDuration(Long artificerId);
IPage<Artificer> getHomeStartArtificerList(Page<Artificer> page,@Param("isStart")Integer isStart, @Param("status")Integer status, @Param("city")String city);
/**
* 查询有效技师
* @return
*/
List<Artificer> getYxjsList();
}

View File

@ -106,4 +106,20 @@ public interface OrdersDao extends BaseMapper<Orders> {
String selectTaxiMoney(Long artificerId, String endDate, String startDate);
String earnings(Long artificerId, String endDate, String startDate);
/**
* 统计技师price价格
* startTime 开始时间
* endTime 结束时间
* artificerId 技师id
* ordersQueryWrapper
* @return
*/
String selectTjpriceList(Orders ordersQueryWrapper);
IPage<Orders> getDangqiList(Page<Orders> pages, Long userId, Integer isSfwc, String startTime, String endTime);
IPage<Orders> getJiazhongList(Page<Orders> pages, Long userId, Integer isSfwc, String startTime, String endTime);
IPage<Orders> getChongzhiList(Page<Orders> pages, Long userId, Integer isSfwc, String startTime, String endTime);
}

View File

@ -151,6 +151,10 @@ public class Artificer implements Serializable {
*/
private Integer isStart;
/**
* 是否参与积分规则计算0不参与 1参与
*/
private Integer ynJfgz;
/**
* 1可服务 2可预约 3休息中

View File

@ -305,6 +305,10 @@ public class Orders implements Serializable {
* 用户服务包明细ID
*/
private Long userPackageDetailId;
/**
* 拒单内容
*/
private String refusalContent;
/**
* 项目名称
@ -368,5 +372,8 @@ public class Orders implements Serializable {
private String shopPhone;
@TableField(exist = false)
private String userRecharge;
public Orders() {}
}

View File

@ -39,4 +39,6 @@ public interface ArtificerService extends IService<Artificer> {
Result selectArtificerByArtificerId(Long artificerId);
Result getHomeArtificerList(Integer page, Integer limit, Integer isStart,Integer status, String city, String longitude, String latitude);
Result getOrderTypeList(Long userId, Integer page, Integer limit, Integer orderType, Integer isSfwc,String startTime,String endTime);
}

View File

@ -97,4 +97,11 @@ public interface OrdersService extends IService<Orders> {
Result selectDividedIntoDetails(Integer page, Integer limit, Period period);
Result splitDetails(Period period);
/**
* 技师确认接单
* @param ordersId 订单id
* @return
*/
Result jishiQueren(Long ordersId);
}

View File

@ -433,4 +433,33 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
return Result.success(map);
}
/**
* 技师首页获取当期订单加钟订单充值订单
* @param userId 技师id
* @param page 第几页
* @param limit 每页几条
* @param orderType 类型 1当期 2加钟 3充值
* @param isSfwc 0不包含 1包含 空为全部
* @param startTime 开始时间
* @param endTime 结束时间
* @return
*/
@Override
public Result getOrderTypeList(Long userId, Integer page, Integer limit, Integer orderType, Integer isSfwc,String startTime,String endTime) {
Map<String, Object> map = new HashMap<String, Object>();
Page<Orders> pages=new Page<>(page,limit);
IPage<Orders> ordersIPage = null;
if(orderType == 1){//1当期
ordersIPage = ordersDao.getDangqiList(pages, userId,isSfwc,startTime,endTime);
}else if(orderType == 2){//2加钟
ordersIPage = ordersDao.getJiazhongList(pages, userId,isSfwc,startTime,endTime);
}else if(orderType == 3){//3充值
ordersIPage = ordersDao.getChongzhiList(pages, userId,isSfwc,startTime,endTime);
}
map.put("data",new PageUtils(ordersIPage));
return Result.success(map);
}
}

View File

@ -36,6 +36,12 @@ import com.sqx.modules.consortia.entity.Consortia;
import com.sqx.modules.consortia.service.ConsortiaService;
import com.sqx.modules.coupon.entity.CouponUser;
import com.sqx.modules.coupon.service.CouponUserService;
import com.sqx.modules.material.dao.MaterialArtificerMapper;
import com.sqx.modules.material.dao.MaterialMapper;
import com.sqx.modules.material.dao.MaterialMassageMapper;
import com.sqx.modules.material.entity.Material;
import com.sqx.modules.material.entity.MaterialArtificer;
import com.sqx.modules.material.entity.MaterialMassage;
import com.sqx.modules.material.service.MaterialArtificerService;
import com.sqx.modules.message.entity.MessageInfo;
import com.sqx.modules.message.service.MessageService;
@ -122,6 +128,14 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
private MaterialArtificerService materialArtificerService;
@Autowired
private ArtificerDao artificerDao;
@Autowired
private MaterialMassageMapper materialMassageMapper;
@Autowired
private MaterialArtificerMapper materialArtificerMapper;
@Autowired
private MaterialMapper materialMapper;
private ReentrantReadWriteLock reentrantReadWriteLock = new ReentrantReadWriteLock(true);
@ -2645,4 +2659,77 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
//分成明细添加到返回对象中
return Result.success().put("data", trees);
}
/**
* 技师确认接单
* @param ordersId 订单id
* @return
*/
@Override
public Result jishiQueren(Long ordersId) {
//获取项目是否包含物料包
Orders orders = ordersDao.selectById(ordersId);
Long messageTypeId = orders.getMassageTypeId();
// MassageType massageType =massageTypeService.getById(messageTypeId);
QueryWrapper<MaterialMassage> materialMassageQueryWrapper = new QueryWrapper<>();
materialMassageQueryWrapper.eq("massage_type_id",messageTypeId);
//查询服务是否消耗指定的物料信息
List<MaterialMassage> wllist =materialMassageMapper.selectList(materialMassageQueryWrapper);
if(wllist.size()>0){
int code = 200;
String msg = "已确认接单";
for(MaterialMassage par: wllist){
QueryWrapper<MaterialArtificer> materialArtificerQueryWrapper = new QueryWrapper<MaterialArtificer>();
materialArtificerQueryWrapper.eq("material_id",par.getMaterialId());
materialArtificerQueryWrapper.eq("artificer_id",orders.getArtificerId());
materialArtificerQueryWrapper.orderByDesc("residue");
materialArtificerQueryWrapper.last("limit 1");
//获取技师是否有对应的物料
MaterialArtificer materialArtificer = materialArtificerMapper.selectOne(materialArtificerQueryWrapper);
if(materialArtificer == null){
//获取缺少的物料
Material material = materialMapper.getById(par.getMaterialId());
code = 500;
msg = "此服务需要【"+material.getMaterialName()+"】物料,您还没有此物料信息";
break;
}
BigDecimal consume = par.getConsume();//每次服务需要消耗的数量
BigDecimal residue = materialArtificer.getResidue();//技师剩余物料库存
if(residue.compareTo(consume) < 0){//库存不足
//获取缺少的物料
Material material = materialMapper.getById(par.getMaterialId());
code = 500;
msg = ""+material.getMaterialName()+"】库存不足,剩余数量:【"+residue+"】,消耗数量:【"+consume+"";
break;
}
}
orders = new Orders();
orders.setOrdersId(ordersId);
orders.setStatus(2);//确认接单
ordersDao.updateById(orders);
if(code == 200){
Map<String,Object> map = new HashMap<>();
map.put("code",code);
map.put("msg",msg);
return Result.success(map);
}else{
return Result.error(msg);
}
}else{
orders = new Orders();
orders.setOrdersId(ordersId);
orders.setStatus(2);//确认接单
ordersDao.updateById(orders);
Map<String,Object> map = new HashMap<>();
map.put("code",200);
map.put("msg","已确认接单");
return Result.success(map);
}
}
}

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sqx.modules.material.entity.MaterialMassage;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author Administrator
* @description 针对表material_massage(物料包与服务表中间表)的数据库操作Mapper
@ -13,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface MaterialMassageMapper extends BaseMapper<MaterialMassage> {
List<MaterialMassage> selectWlList(Long messageTypeId);
}

View File

@ -199,4 +199,12 @@
order by artificer_sales desc
</select>
<select id="getYxjsList" resultType="com.sqx.modules.artificer.entity.Artificer">
select a.* from artificer a
inner join tb_user u on a.user_id=u.user_id
where u.status = 1
</select>
</mapper>

View File

@ -910,7 +910,7 @@
left join tb_user u on u.user_id=o.user_id
left join consortia c on c.consortia_id=o.consortia_id
where o.artificer_id=#{artificerId}
and o.pay_time BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate}
and o.status in (3,5)
</select>
<!-- 订单数-->
@ -922,7 +922,7 @@
left join tb_user u on u.user_id=o.user_id
left join consortia c on c.consortia_id=o.consortia_id
where o.artificer_id=#{artificerId}
and o.pay_time BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate}
and o.status in (3,5)
and o.parent_id = 0
</select>
@ -935,7 +935,7 @@
left join tb_user u on u.user_id=o.user_id
left join consortia c on c.consortia_id=o.consortia_id
where o.artificer_id=#{artificerId}
and o.pay_time BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate}
</select>
<!-- 充值率-->
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
@ -947,7 +947,7 @@
left join consortia c on c.consortia_id=o.consortia_id
left join user_recharge uu on uu.orders_id = o.orders_id
where o.artificer_id=#{artificerId}
and o.pay_time BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate}
and uu.type = 2
</select>
<!-- 储值积分数-->
@ -988,8 +988,60 @@
left join tb_user u on u.user_id=o.user_id
left join consortia c on c.consortia_id=o.consortia_id
where o.artificer_id=#{artificerId}
and o.pay_time BETWEEN #{startDate} and #{endDate}
and o.end_times BETWEEN #{startDate} and #{endDate}
and o.status in (3,5)
</select>
<select id="selectTjpriceList" resultType="java.lang.String">
select
IFNULL( SUM(o.price ),'0.00') AS currentPerformance
from orders o
where o.artificer_id=#{artificerId}
and o.end_times BETWEEN #{startTime} and #{endTime}
and o.status in (3,5)
</select>
<select id="getDangqiList" resultType="com.sqx.modules.artificer.entity.Orders">
select * from orders
where status in (3,5)
and artificer_id = ${userId}
and end_times BETWEEN #{startTime} and #{endTime}
</select>
<select id="getJiazhongList" resultType="com.sqx.modules.artificer.entity.Orders">
select * from orders
where status in (3,5)
and artificer_id = ${userId}
and end_times BETWEEN #{startTime} and #{endTime}
<if test="isSfwc != null and isSfwc == 0">
and (add_num = 0 or add_num is null)
</if>
<if test="isSfwc != null and isSfwc == 1">
and add_num > 0
</if>
</select>
<select id="getChongzhiList" resultType="com.sqx.modules.artificer.entity.Orders">
select
a.*,uu.user_recharge as userRecharge
from orders o
left join artificer a on a.artificer_id=o.artificer_id
left join tb_user u on u.user_id=o.user_id
left join consortia c on c.consortia_id=o.consortia_id
left join user_recharge uu on uu.orders_id = o.orders_id
where o.artificer_id=#{userId}
and o.status in (3,5)
and o.end_times BETWEEN #{startTime} and #{endTime}
<if test="isSfwc != null and isSfwc == 0">
and uu.type = 2
</if>
<if test="isSfwc != null and isSfwc == 1">
and uu.type != 2
</if>
</select>
</mapper>

View File

@ -20,4 +20,10 @@
consume,create_user,create_time,
update_user,update_time
</sql>
<select id="selectWlList" resultType="com.sqx.modules.material.entity.MaterialMassage">
</select>
</mapper>