From be49e1afd60e1437d3b150ba7b7ac95cb976428b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E7=A3=8A?= <45566618@qq.com> Date: Sat, 26 Oct 2024 16:26:11 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9B=9B=E5=AE=89=E6=96=B0=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E9=97=AE=E9=A2=98=E4=BC=98=E5=8C=96-1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/controller/UserController.java | 6 ++ .../sqx/modules/app/service/UserService.java | 2 + .../app/service/impl/UserServiceImpl.java | 14 +++ .../controller/ArtificerController.java | 24 ++++- .../app/AppArtificerController.java | 8 +- .../modules/artificer/entity/Artificer.java | 7 +- .../modules/artificer/entity/MassageType.java | 3 + .../service/ArtificerMassageService.java | 2 +- .../artificer/service/ArtificerService.java | 1 + .../impl/ArtificerMassageServiceImpl.java | 7 +- .../service/impl/ArtificerServiceImpl.java | 87 +++++++++++++++++++ .../service/impl/OrdersServiceImpl.java | 29 +++++-- .../dao/ArtificerIntegralStatisticsDao.java | 10 +++ .../bl/order/entity/UserPackageDetail.java | 6 ++ .../bl/order/entity/UserPackageOrder.java | 25 +++++- .../chat/controller/ChatController.java | 9 +- .../modules/message/entity/MessageInfo.java | 7 ++ .../mapper/artificer/ArtificerDao.xml | 7 +- .../resources/mapper/artificer/OrdersDao.xml | 14 ++- .../ArtificerIntegralStatisticsDao.xml | 24 +++++ .../mapper/bl/order/UserPackageOrderDao.xml | 14 ++- 21 files changed, 282 insertions(+), 24 deletions(-) diff --git a/src/main/java/com/sqx/modules/app/controller/UserController.java b/src/main/java/com/sqx/modules/app/controller/UserController.java index 44d8df2..c5f2817 100644 --- a/src/main/java/com/sqx/modules/app/controller/UserController.java +++ b/src/main/java/com/sqx/modules/app/controller/UserController.java @@ -667,4 +667,10 @@ public class UserController { public Result integral(String type,Integer current,Integer size,String date,String artificerId) throws ParseException { return Result.success(userService.integral(type,current,size,date,artificerId)); } + + @PostMapping("/integralPc") + @ApiOperation("积分") + public Result integralPc(String type,Integer current,Integer size,String date,String artificerId) throws ParseException { + return Result.success(userService.integralPc(type,current,size,date,artificerId)); + } } \ No newline at end of file diff --git a/src/main/java/com/sqx/modules/app/service/UserService.java b/src/main/java/com/sqx/modules/app/service/UserService.java index 0a538d6..d0e6f03 100644 --- a/src/main/java/com/sqx/modules/app/service/UserService.java +++ b/src/main/java/com/sqx/modules/app/service/UserService.java @@ -218,5 +218,7 @@ public interface UserService extends IService { Result integral(String type, Integer current, Integer size, String date,String artificerId) throws ParseException; + Result integralPc(String type, Integer current, Integer size, String date,String artificerId) throws ParseException; + IPage merchantPromotion(UserEntity userEntity, Integer page, Integer limit); } diff --git a/src/main/java/com/sqx/modules/app/service/impl/UserServiceImpl.java b/src/main/java/com/sqx/modules/app/service/impl/UserServiceImpl.java index dd936fb..963a4f4 100644 --- a/src/main/java/com/sqx/modules/app/service/impl/UserServiceImpl.java +++ b/src/main/java/com/sqx/modules/app/service/impl/UserServiceImpl.java @@ -40,6 +40,8 @@ import com.sqx.modules.app.utils.UserConstantInterface; import com.sqx.modules.artificer.dao.UserRechargeDao; import com.sqx.modules.artificer.entity.Artificer; import com.sqx.modules.artificer.service.ArtificerService; +import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao; +import com.sqx.modules.bl.artificer.service.ArtificerIntegralStatisticsService; import com.sqx.modules.common.entity.CommonInfo; import com.sqx.modules.common.service.CommonInfoService; import com.sqx.modules.file.utils.Md5Utils; @@ -102,6 +104,8 @@ public class UserServiceImpl extends ServiceImpl implements private ArtificerService artificerService; @Autowired private UserRechargeDao userRechargeDao; + @Autowired + ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao; @Override public UserEntity queryByPhone(String phone) { @@ -1285,6 +1289,16 @@ public class UserServiceImpl extends ServiceImpl implements return Result.success().put("data", userRechargeDao.integralArtificerId(new Page<>(current, size), type, startDate, endDate, artificerId)); } + @Override + public Result integralPc(String type, Integer current, Integer size, String date,String artificerId) throws ParseException { + if (org.apache.commons.lang3.StringUtils.isEmpty(date)) { + date = DateUtil.formatDate(DateUtil.date()); + } + String startDate = DateUtil.formatDateTime(obtainCycle(DateUtil.parse(date)).getStartFundData()); + String endDate = DateUtil.formatDate(obtainCycle(DateUtil.parse(date)).getEndFundData()) + " 23:59:59"; + return Result.success().put("data", artificerIntegralStatisticsDao.getIntegralPage(new Page<>(current, size), type, startDate, endDate, artificerId)); + } + @Override public IPage merchantPromotion(UserEntity userEntity,Integer page, Integer limit) { IPage pages = new Page<>(page, limit); diff --git a/src/main/java/com/sqx/modules/artificer/controller/ArtificerController.java b/src/main/java/com/sqx/modules/artificer/controller/ArtificerController.java index be0e26b..d99ac2f 100644 --- a/src/main/java/com/sqx/modules/artificer/controller/ArtificerController.java +++ b/src/main/java/com/sqx/modules/artificer/controller/ArtificerController.java @@ -71,6 +71,28 @@ public class ArtificerController { return Result.success(); } + @PostMapping("/addSelectionMassages") + @ApiOperation("批量添加按摩分类") + public Result addSelectionMassages(@RequestBody MassageType massageType){ + String ids = massageType.getIds(); + if(!ids.equals("")){ + String[] idArr = ids.split(","); + if(idArr.length>0){ + for(int i=0;i { Result updateArtificerMassage(ArtificerMassage artificerMassage); - Result deleteArtificerMassage(Long id); + Result deleteArtificerMassage(String id); Result selectArtificerMassage(Long userId, Integer page, Integer limit, Integer status); diff --git a/src/main/java/com/sqx/modules/artificer/service/ArtificerService.java b/src/main/java/com/sqx/modules/artificer/service/ArtificerService.java index 2986925..73b4707 100644 --- a/src/main/java/com/sqx/modules/artificer/service/ArtificerService.java +++ b/src/main/java/com/sqx/modules/artificer/service/ArtificerService.java @@ -40,6 +40,7 @@ public interface ArtificerService extends IService { Result integral(String artificerId,String type,Integer current,Integer size,String date,Integer fundType); Result storedValue(String date,String type,String artificerId); + Result storedValuePc(String date,String type,String artificerId); Result selectArtificerByArtificerId(Long artificerId); diff --git a/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerMassageServiceImpl.java b/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerMassageServiceImpl.java index 298509c..b12001d 100644 --- a/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerMassageServiceImpl.java +++ b/src/main/java/com/sqx/modules/artificer/service/impl/ArtificerMassageServiceImpl.java @@ -80,8 +80,11 @@ public class ArtificerMassageServiceImpl extends ServiceImpl i userIdList = artificerClassifyService.getUserIdByClassify(classifyIdList); } } + + Period period = new Period(); + period.setFundType(1); + period.setFundData(new Date()); + Period period1 = calculationPeriod(period); + Date startFundData = period1.getStartFundData(); + Date endFundData = period1.getEndFundData(); + String startTime = DateUtil.formatDateTime(startFundData); + String endTime = DateUtil.formatDateTime(endFundData); + IPage artificerIPage = baseMapper.selectArtificerList(pages, massageTypeId, artificerName, longitude, latitude, sort, authentication, by, status, city, classifyId,phone,user,isStart,technicianType,isBack,userIdList,isGoods); @@ -382,6 +392,13 @@ public class ArtificerServiceImpl extends ServiceImpl i } artificer.setArtificerClassifyList(artificerClassifyList); } + Long userId = artificer.getArtificerId(); + BigDecimal sumJf = BigDecimal.ZERO; + ArtificerIntegralStatistics artificerIntegralStatistics = artificerIntegralStatisticsService.getIntegralStatistics(userId,startTime,endTime,null); + if(artificerIntegralStatistics != null){ + sumJf = artificerIntegralStatistics.getIntegral(); + } + artificer.setDqjf(sumJf); } return Result.success().put("data",new PageUtils(artificerIPage)); } @@ -853,6 +870,76 @@ public class ArtificerServiceImpl extends ServiceImpl i return Result.success().put("data", map); } + @Override + public Result storedValuePc(String date, String type, String artificerId) { + Map map = Maps.newHashMap(); + Period period = new Period(); + period.setFundType(1); + period.setFundData(DateUtil.parse(date)); + Period period1 = calculationPeriod(period); + Date startFundData = period1.getStartFundData(); + Date endFundData = period1.getEndFundData(); + + String start = DateUtil.formatDateTime(startFundData); + String end = DateUtil.formatDateTime(endFundData); + + Long userId = Long.valueOf(artificerId); + + //总积分 + BigDecimal sumJf = BigDecimal.ZERO; + ArtificerIntegralStatistics artificerIntegralStatistics = artificerIntegralStatisticsService.getIntegralStatistics(userId,start,end,null); + if(artificerIntegralStatistics != null){ + sumJf = artificerIntegralStatistics.getIntegral(); + } + map.put("sumJf", sumJf.toString()); + + //1.获取在线时长积分 + BigDecimal zxscjf = BigDecimal.ZERO; + ArtificerIntegralStatistics zxjfVo = artificerIntegralStatisticsService.getIntegralStatistics(userId,start,end,1); + if(zxjfVo != null) { + zxscjf = zxjfVo.getIntegral(); + } + map.put("zxscjf", zxscjf.toString()); + BigDecimal i = new BigDecimal(commonInfoDao.findOne(100000).getValue()); + BigDecimal i1 = zxscjf.multiply(i).divide(new BigDecimal(60),1,BigDecimal.ROUND_HALF_UP); + //在线时长 + map.put("zxsc", i1.toString());//时长小时 + + //2.获取储值积分(为他充值的) + BigDecimal czjf = BigDecimal.ZERO; + ArtificerIntegralStatistics chuzjfVo = artificerIntegralStatisticsService.getIntegralStatistics(userId,start,end,2); + if(chuzjfVo != null){ + czjf = chuzjfVo.getIntegral(); + } + map.put("chuzjf", czjf.toString()); + + //3.获取业绩积分 + BigDecimal yjjf = BigDecimal.ZERO; + ArtificerIntegralStatistics yejfVo = artificerIntegralStatisticsService.getIntegralStatistics(userId,start,end,3); + if(yejfVo != null){ + yjjf = yejfVo.getIntegral(); + } + map.put("yjjf", yjjf.toString()); + + //4.获取系统调整积分 + BigDecimal tzjf = BigDecimal.ZERO; + ArtificerIntegralStatistics tzjfVo = artificerIntegralStatisticsService.getIntegralStatistics(userId,start,end,4); + if(tzjfVo != null){ + tzjf = tzjfVo.getIntegral(); + } + map.put("tzjf", tzjf.toString()); + + //5.获取订单充值积分 + BigDecimal ddczjf = BigDecimal.ZERO; + ArtificerIntegralStatistics chongzjfVo = artificerIntegralStatisticsService.getIntegralStatistics(userId,start,end,5); + if(chongzjfVo != null) { + ddczjf = chongzjfVo.getIntegral(); + } + map.put("chongzjf", ddczjf.toString()); + + return Result.success().put("data", map); + } + @Override public Result selectArtificerByArtificerId(Long artificerId) { return Result.success().put("data", baseMapper.selectById(artificerId)); diff --git a/src/main/java/com/sqx/modules/artificer/service/impl/OrdersServiceImpl.java b/src/main/java/com/sqx/modules/artificer/service/impl/OrdersServiceImpl.java index 8e47463..ea1adb3 100644 --- a/src/main/java/com/sqx/modules/artificer/service/impl/OrdersServiceImpl.java +++ b/src/main/java/com/sqx/modules/artificer/service/impl/OrdersServiceImpl.java @@ -5318,12 +5318,29 @@ public class OrdersServiceImpl extends ServiceImpl implements for (Orders orders : records) { List ordersMassageList = ordersMassageService.list(new QueryWrapper().eq("orders_id", orders.getOrdersId())); for (OrdersMassage ordersMassage : ordersMassageList) { - MassageType massageType = massageTypeService.getById(ordersMassage.getMassageId()); - ordersMassage.setMassageType(massageType); - if (massageType != null) { - SysDictEntity sysDictEntity = sysDictService.getById(massageType.getClassifyId()); - if (sysDictEntity != null) { - massageType.setClassifyName(sysDictEntity.getValue()); + if(orders.getUserPackageDetailId() !=null){ + UserPackageDetail userPackageDetail = userPackageDetailService.getById(ordersMassage.getMassageId()); + if(userPackageDetail!=null){ + UserPackage userPackage = userPackageService.getById(userPackageDetail.getMainId()); + orders.setPackageType(userPackage.getType()); + userPackageDetail.setMainTitle(userPackage.getTitle()); + userPackageDetail.setMainPrice(userPackage.getPrice()); + ordersMassage.setUserPackageDetail(userPackageDetail); + if (userPackageDetail != null) { + SysDictEntity sysDictEntity = sysDictService.getById(userPackageDetail.getClassifyId()); + if (sysDictEntity != null) { + userPackageDetail.setClassifyName(sysDictEntity.getValue()); + } + } + } + }else{ + MassageType massageType = massageTypeService.getById(ordersMassage.getMassageId()); + ordersMassage.setMassageType(massageType); + if (massageType != null) { + SysDictEntity sysDictEntity = sysDictService.getById(massageType.getClassifyId()); + if (sysDictEntity != null) { + massageType.setClassifyName(sysDictEntity.getValue()); + } } } } diff --git a/src/main/java/com/sqx/modules/bl/artificer/dao/ArtificerIntegralStatisticsDao.java b/src/main/java/com/sqx/modules/bl/artificer/dao/ArtificerIntegralStatisticsDao.java index 7d3a3be..c5e1341 100644 --- a/src/main/java/com/sqx/modules/bl/artificer/dao/ArtificerIntegralStatisticsDao.java +++ b/src/main/java/com/sqx/modules/bl/artificer/dao/ArtificerIntegralStatisticsDao.java @@ -1,8 +1,12 @@ package com.sqx.modules.bl.artificer.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.sqx.modules.artificer.entity.UserRecharge; import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -10,4 +14,10 @@ import java.util.List; public interface ArtificerIntegralStatisticsDao extends BaseMapper { ArtificerIntegralStatistics getIntegralStatistics(Long artificerId,String startDate,String endDate,Integer classify); List getIntegralList(Long artificerId, String startDate, String endDate, Integer classify); + IPage getIntegralPage(@Param("pages") Page pages, + @Param("classify") String classify, + @Param("startDate") String startDate, + @Param("endDate") String endDate, + @Param("artificerId") String artificerId); + } \ No newline at end of file diff --git a/src/main/java/com/sqx/modules/bl/order/entity/UserPackageDetail.java b/src/main/java/com/sqx/modules/bl/order/entity/UserPackageDetail.java index f913665..64afa43 100644 --- a/src/main/java/com/sqx/modules/bl/order/entity/UserPackageDetail.java +++ b/src/main/java/com/sqx/modules/bl/order/entity/UserPackageDetail.java @@ -123,6 +123,12 @@ public class UserPackageDetail implements Serializable { */ private Long classifyId; + /** + * 类型 + */ + @TableField(exist = false) + private String classifyName; + /** * 适用人群 */ diff --git a/src/main/java/com/sqx/modules/bl/order/entity/UserPackageOrder.java b/src/main/java/com/sqx/modules/bl/order/entity/UserPackageOrder.java index ef14cee..9f94350 100644 --- a/src/main/java/com/sqx/modules/bl/order/entity/UserPackageOrder.java +++ b/src/main/java/com/sqx/modules/bl/order/entity/UserPackageOrder.java @@ -24,7 +24,6 @@ public class UserPackageOrder implements Serializable { private static final long serialVersionUID = 1L; @TableId(type = IdType.AUTO) - /** * 订单id */ @@ -169,6 +168,30 @@ public class UserPackageOrder implements Serializable { @TableField(exist = false) private Integer isNewer; + /** + * id + */ + @TableField(exist = false) + private Long id; + + /** + * 名称 + */ + @TableField(exist = false) + private String title; + + /** + * 已使用数量 + */ + @TableField(exist = false) + private Integer usedQuantity; + + /** + * 未使用数量 + */ + @TableField(exist = false) + private Integer unUsedQuantity; + /** * 差几个人数 */ diff --git a/src/main/java/com/sqx/modules/chat/controller/ChatController.java b/src/main/java/com/sqx/modules/chat/controller/ChatController.java index cc7d02e..52ca7cb 100644 --- a/src/main/java/com/sqx/modules/chat/controller/ChatController.java +++ b/src/main/java/com/sqx/modules/chat/controller/ChatController.java @@ -1,9 +1,11 @@ package com.sqx.modules.chat.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.sqx.common.utils.Result; import com.sqx.modules.chat.service.ChatContentService; import com.sqx.modules.chat.service.ChatConversationService; import com.sqx.modules.chats.service.ChatsService; +import com.sqx.modules.message.entity.MessageInfo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +45,12 @@ public class ChatController { return Result.success(); } - + @GetMapping("/selectChatCount") + @ApiOperation("查询聊天消息总和") + public Result selectChatCount(Long userId){ + int data = chatContentService.selectChatCount(userId); + return Result.success().put("data",data); + } diff --git a/src/main/java/com/sqx/modules/message/entity/MessageInfo.java b/src/main/java/com/sqx/modules/message/entity/MessageInfo.java index a461e48..bae5d77 100644 --- a/src/main/java/com/sqx/modules/message/entity/MessageInfo.java +++ b/src/main/java/com/sqx/modules/message/entity/MessageInfo.java @@ -72,6 +72,13 @@ public class MessageInfo implements Serializable { private String byUserId; + /** + * 0 待审核 + * 1 通过 + * 2 拒绝 + * 空 待处理 + * 1 已处理 + **/ private String type; diff --git a/src/main/resources/mapper/artificer/ArtificerDao.xml b/src/main/resources/mapper/artificer/ArtificerDao.xml index cd4d4fd..a599403 100644 --- a/src/main/resources/mapper/artificer/ArtificerDao.xml +++ b/src/main/resources/mapper/artificer/ArtificerDao.xml @@ -7,7 +7,7 @@ select * from (select a.*,u.phone,s.code as classifyName,u.status as artificerStatus,u.consortia_id,c.consortia_name, (select count(*) from collect_artificer o where o.artificer_id=a.artificer_id and classify=1) as collectCount, (select count(*) from orders o where o.artificer_id=a.artificer_id and o.status in (3,5)) as ordersCount, - ifnull((select avg(c.score) from taking_commnt c where c.artificer_id=a.artificer_id ),5.00) as ordersScore, + round(ifnull((select avg(c.score) from taking_commnt c where c.artificer_id=a.artificer_id ),5.0),1) as ordersScore, (select count(*) from taking_commnt c where c.artificer_id=a.artificer_id ) as commentCount, (st_distance (point (a.longitude, a.latitude),point(#{longitude},#{latitude}) ) *111195) as distance, v.vip_name as technicianTypeName,v.rate as technicianTypeRate ,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) <=7 THEN 1 ELSE 2 END) AS isNewer @@ -110,7 +110,7 @@ (select count(*) from orders o where o.artificer_id = a.artificer_id and o.status in (3,5)) as ordersCount, (select count(*) from collect_artificer o where o.artificer_id = a.artificer_id and classify = 1) as collectCount, (select count(*) from collect_artificer o where o.artificer_id = a.artificer_id and o.user_id = #{userId} and classify = 1) as myCollectCount, - ifnull((select avg(c.score) from taking_commnt c where c.artificer_id = a.artificer_id), 5.00) as ordersScore, + round(ifnull((select avg(c.score) from taking_commnt c where c.artificer_id = a.artificer_id), 5.0),1) as ordersScore, (st_distance(point(a.longitude, a.latitude), point(#{longitude}, #{latitude})) * 111195) as distance, v.vip_name as technicianTypeName,v.rate as technicianTypeRate ,(CASE WHEN DATEDIFF(CURDATE(), a.create_time) <=7 THEN 1 ELSE 2 END) AS isNewer from artificer a @@ -123,8 +123,7 @@ diff --git a/src/main/resources/mapper/bl/artificer/ArtificerIntegralStatisticsDao.xml b/src/main/resources/mapper/bl/artificer/ArtificerIntegralStatisticsDao.xml index 6ea9530..06a68f9 100644 --- a/src/main/resources/mapper/bl/artificer/ArtificerIntegralStatisticsDao.xml +++ b/src/main/resources/mapper/bl/artificer/ArtificerIntegralStatisticsDao.xml @@ -37,4 +37,28 @@ and classify = #{classify} + + + + \ No newline at end of file diff --git a/src/main/resources/mapper/bl/order/UserPackageOrderDao.xml b/src/main/resources/mapper/bl/order/UserPackageOrderDao.xml index f661bcf..8eccbaf 100644 --- a/src/main/resources/mapper/bl/order/UserPackageOrderDao.xml +++ b/src/main/resources/mapper/bl/order/UserPackageOrderDao.xml @@ -22,8 +22,20 @@ a.coupon_money, a.refund_time, a.refund_money, - a.create_time + a.create_time, + c.title, + c.main_id as id, + c.usedQuantity, + c.unUsedQuantity from bl_user_package_order a left join tb_user b on a.user_id = b.user_id + left join + (select + y.orders_no,y.title,x.main_id, + sum(case x.status when 1 then 1 else 0 end) as usedQuantity, + sum(case x.status when 0 then 1 else 0 end) as unUsedQuantity + from bl_user_package_detail x + inner join bl_user_package y on x.main_id = y.id + group by y.orders_no,y.title,x.main_id) c on a.orders_no = c.orders_no where 1=1 and a.status=#{params.status}