盛安新版本问题优化-2、3项目增加推荐;视频圈增加审批;更换微信证书;技师闲时设置;

This commit is contained in:
曹磊 2024-10-31 10:39:32 +08:00
parent be49e1afd6
commit ea21c2f2c3
19 changed files with 189 additions and 64 deletions

View File

@ -125,6 +125,11 @@ public class MassageType implements Serializable {
private Integer qyMinNum;//企业预约最小次数
/**
* 是否推荐0否1是
*/
private Integer isTj;
@TableField(exist = false)
private String ids;

View File

@ -71,17 +71,13 @@ public class ArtificerTimeServiceImpl extends ServiceImpl<ArtificerTimeDao, Arti
map.put("acceptOrders", artificer.getAcceptOrders());
}
ArtificerTimeIdel ati = artificerTimeIdelDao.selectOne(new QueryWrapper<ArtificerTimeIdel>()
.eq("artificer_id", artificerId)
.eq("artificer_date", artificerDate));
.eq("artificer_id", artificerId));
if(ati!=null){
map.put("startTime", ati.getStartTime());
map.put("endTime", ati.getEndTime());
}else{
map.put("startTime", artificerDate+" 00:00:00");
Date endDate = DateUtils.stringToDate(artificerDate,DateUtils.DATE_PATTERN);
endDate = DateUtils.addDateDays(endDate,1);
String endDateStr = DateUtils.format(endDate,DateUtils.DATE_PATTERN);
map.put("endTime", endDateStr+" 00:00:00");
map.put("startTime", "00:00:00");
map.put("endTime", "23:30:00");
}
List<ArtificerTime> artificerTimes = baseMapper.selectList(new QueryWrapper<ArtificerTime>()
.eq("artificer_id", artificerId)
@ -134,14 +130,12 @@ public class ArtificerTimeServiceImpl extends ServiceImpl<ArtificerTimeDao, Arti
QueryWrapper qwi = new QueryWrapper<ArtificerTimeIdel>();
qwi.eq("artificer_id", artificer.getArtificerId());
qwi.eq("artificer_date", startDay);
artificerTimeIdelDao.delete(qwi);
ArtificerTimeIdel ati = new ArtificerTimeIdel();
ati.setArtificerId(artificer.getArtificerId());
ati.setArtificerDate(startDay);
ati.setStartTime(idelTimes[0]);
ati.setEndTime(idelTimes[1]);
ati.setStartTime(startTime);
ati.setEndTime(endTime);
ati.setCreateTime(DateUtils.format(new Date()));
artificerTimeIdelDao.insert(ati);
@ -189,7 +183,7 @@ public class ArtificerTimeServiceImpl extends ServiceImpl<ArtificerTimeDao, Arti
Date startDate = DateUtils.stringToDate(startDateStr,"yyyy-MM-dd HH:mm");
Date endDate = DateUtils.stringToDate(endDateStr,"yyyy-MM-dd HH:mm");
Date current = startDate;
while(current.getTime()<endDate.getTime()){
while(current.getTime()<=endDate.getTime()){
String day = DateUtils.format(current,"yyyy-MM-dd");
String time = DateUtils.format(current,"HH:mm");
if(map.get(day)!=null){

View File

@ -60,6 +60,13 @@ public class MassagePackageController {
return Result.success();
}
@PostMapping("/updateTj")
@ApiOperation("修改推荐")
public Result updateTj(MassagePackage massagePackage){
service.updateTj(massagePackage);
return Result.success();
}
@PostMapping("/updateStatus")
@ApiOperation("修改状态")
public Result updateStatus(MassagePackage massagePackage){

View File

@ -16,6 +16,7 @@ public interface MassagePackageDao extends BaseMapper<MassagePackage> {
int updateCoupon(MassagePackage massagePackage);
int updateVip(MassagePackage massagePackage);
int updateNewer(MassagePackage massagePackage);
int updateTj(MassagePackage massagePackage);
int updateStatus(MassagePackage massagePackage);
int updatePrice(MassagePackage massagePackage);
int delete(MassagePackage massagePackage);

View File

@ -161,6 +161,11 @@ public class MassagePackage implements Serializable {
*/
private Integer isNewer;
/**
* 是否推荐0否1是
*/
private Integer isTj;
/**
* 服务次数
*/

View File

@ -12,6 +12,7 @@ public interface MassagePackageService extends IService<MassagePackage> {
int updateCoupon(MassagePackage massagePackage);
int updateVip(MassagePackage massagePackage);
int updateNewer(MassagePackage massagePackage);
int updateTj(MassagePackage massagePackage);
int updateStatus(MassagePackage massagePackage);
int updatePrice(MassagePackage massagePackage);
int delete(MassagePackage massagePackage);

View File

@ -81,6 +81,10 @@ public class MassagePackageServiceImpl extends ServiceImpl<MassagePackageDao, Ma
return baseMapper.updateNewer(massagePackage);
}
@Override
public int updateTj(MassagePackage massagePackage){
return baseMapper.updateTj(massagePackage);
}
@Override
public int updateStatus(MassagePackage massagePackage){
return baseMapper.updateStatus(massagePackage);
}

View File

@ -3861,6 +3861,7 @@ public class WxServiceImpl implements WxService {
double total_fee = 0.00;
data.put("total_fee", new Double(payMoney.doubleValue() * 100).intValue() + ""); //1块等于微信支付传入100);
data.put("refund_fee", new Double(refundMoney.doubleValue() * 100).intValue() + ""); //1块等于微信支付传入100);
System.out.println(data);
//使用官方API退款
try {
Map<String, String> response = wxpay.refund(data);

View File

@ -1,22 +1,16 @@
package com.sqx.modules.shipinquan.content;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sqx.common.utils.Result;
import com.sqx.modules.shipinquan.entity.BlShipinquan;
import com.sqx.modules.shipinquan.service.BlShipinquanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@RestController
@RequestMapping("/bl/shipinquan")
public class BlShipinquanController {
@ -28,10 +22,7 @@ public class BlShipinquanController {
@GetMapping("/list")
@ApiOperation("获取数据列表")
public Result list(BlShipinquan entity, Integer page, Integer limit){
QueryWrapper<BlShipinquan> qw = new QueryWrapper<>();
qw.orderByDesc("create_time");
IPage<BlShipinquan> pageList = service.page(new Page<>(page,limit),qw);
return Result.success().put("data",pageList);
return service.findPage(page,limit,entity);
}
@PostMapping("/add")
@ -57,4 +48,12 @@ public class BlShipinquanController {
return Result.success();
}
@PostMapping("/approve")
@ApiOperation("审批")
public Result approve(BlShipinquan BlShipinquan){
service.approve(BlShipinquan);
return Result.success();
}
}

View File

@ -38,7 +38,7 @@ public class AppShipinquanController {
@GetMapping("/list")
@ApiOperation("获取视频数据列表")
public Result list(Integer page, Integer limit, Long createBy,String userId,String gzrId,String longitude,String latitude){
public Result list(Integer page, Integer limit, Long createBy,String userId,String gzrId,String longitude,String latitude,String status){
if(page==null){
page=1;
limit=10;
@ -49,6 +49,7 @@ public class AppShipinquanController {
entity.setLongitude(longitude);
entity.setLatitude(latitude);
entity.setGzrId(gzrId);
entity.setStatus(status);
return service.findPage(page,limit,entity);
}

View File

@ -11,4 +11,5 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface BlShipinquanDao extends BaseMapper<BlShipinquan> {
IPage<BlShipinquan> findPage(Page<BlShipinquan> page, @Param("params") BlShipinquan entity);
int approve(BlShipinquan entity);
}

View File

@ -19,8 +19,8 @@ public class BlShipinquan implements Serializable {
@TableId(type = IdType.AUTO)
private Long id;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;//创建实践
private Long createBy;//创建人
private String content;//发布内容
@ -29,6 +29,16 @@ public class BlShipinquan implements Serializable {
private int dzs;//点赞数
private int pls;//评论数
private int type;//类型0视频1图片目前都是视频预留
private String status;//审批0待审批 1通过 2拒绝
private String opinion;//审批意见
/**
*审批时间
*/
private String approveTime;
/**
*审批人
*/
private Long approveUser;
@TableField(exist = false)
private String artificerImg;

View File

@ -6,4 +6,5 @@ import com.sqx.modules.shipinquan.entity.BlShipinquan;
public interface BlShipinquanService extends IService<BlShipinquan> {
Result findPage(Integer page, Integer limit, BlShipinquan entity);
int approve(BlShipinquan entity);
}

View File

@ -7,8 +7,13 @@ import com.sqx.common.utils.Result;
import com.sqx.modules.shipinquan.dao.BlShipinquanDao;
import com.sqx.modules.shipinquan.entity.BlShipinquan;
import com.sqx.modules.shipinquan.service.BlShipinquanService;
import com.sqx.modules.sys.entity.SysUserEntity;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
@Service
public class BlShipinquanServiceImpl extends ServiceImpl<BlShipinquanDao, BlShipinquan> implements BlShipinquanService {
@Override
@ -16,4 +21,12 @@ public class BlShipinquanServiceImpl extends ServiceImpl<BlShipinquanDao, BlShip
Page<BlShipinquan> pages=new Page<>(page,limit);
return Result.success().put("data",new PageUtils(baseMapper.findPage(pages,entity)));
}
@Override
public int approve(BlShipinquan entity){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
entity.setApproveTime(sdf.format(new Date()));
entity.setApproveUser(((SysUserEntity) SecurityUtils.getSubject().getPrincipal()).getUserId());
return baseMapper.approve(entity);
}
}

View File

@ -6,13 +6,8 @@ import com.sqx.modules.app.entity.UserMoney;
import com.sqx.modules.app.entity.UserSadDetails;
import com.sqx.modules.app.service.UserMoneyService;
import com.sqx.modules.app.service.UserSadDetailsService;
import com.sqx.modules.artificer.dao.ArtificerDao;
import com.sqx.modules.artificer.dao.BlArtificerZqhzDao;
import com.sqx.modules.artificer.dao.OrdersDao;
import com.sqx.modules.artificer.dao.UserRechargeDao;
import com.sqx.modules.artificer.entity.Artificer;
import com.sqx.modules.artificer.entity.BlArtificerZqhz;
import com.sqx.modules.artificer.entity.UserRecharge;
import com.sqx.modules.artificer.dao.*;
import com.sqx.modules.artificer.entity.*;
import com.sqx.modules.bl.artificer.dao.ArtificerIntegralStatisticsDao;
import com.sqx.modules.bl.artificer.dao.ArtificerPartitioningDetailsDao;
import com.sqx.modules.bl.artificer.entity.ArtificerIntegralStatistics;
@ -32,10 +27,8 @@ import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class AllTaskServiceImpl implements AllTaskSercice {
@ -70,6 +63,10 @@ public class AllTaskServiceImpl implements AllTaskSercice {
private UserMoneyService userMoneyService;
@Autowired
private ArtificerIntegralStatisticsDao artificerIntegralStatisticsDao;
@Autowired
private ArtificerTimeDao artificerTimeDao;
@Autowired
private ArtificerTimeIdelDao artificerTimeIdelDao;
/**
* 计算技师升级规则 每天半夜1点执行预留12点到01点之间的计算间隔用于触发其他计算逻辑
@ -406,4 +403,90 @@ public class AllTaskServiceImpl implements AllTaskSercice {
blSadJobService.updateById(par);
}
}
//技师每天闲时配置
@Scheduled(cron = "10 00 0 * * ?")
public void setArtificerTime() {
String curDate = DateUtils.format(new Date(),DateUtils.DATE_PATTERN);
QueryWrapper<ArtificerTimeIdel> queryWrapper = new QueryWrapper<ArtificerTimeIdel>();
queryWrapper.apply("id in ( select max(id) from artificer_time_idel b group by artificer_id )");
List<ArtificerTimeIdel> artificerTimeIdelList = artificerTimeIdelDao.selectList(queryWrapper);
for(int i=0;i<artificerTimeIdelList.size();i++){
ArtificerTimeIdel ati = artificerTimeIdelList.get(i);
String startTime = ati.getStartTime();
String endTime = ati.getEndTime();
Long artificerId = ati.getArtificerId();
Map<String,List> dateMap = getIdelMap(curDate+" "+startTime,curDate+" "+endTime);
Map<String,List> busyMap = getBusyMap(dateMap);
for (String key : busyMap.keySet()) {
List<String> busyTimeList = busyMap.get(key);
for(String time : busyTimeList){
Integer counts = artificerTimeDao.selectCount(new QueryWrapper<ArtificerTime>().eq("artificer_date", key).eq("artificer_id", artificerId).eq("artificer_time", time));
if(counts==0){
ArtificerTime artificerTime=new ArtificerTime();
artificerTime.setArtificerDate(key);
artificerTime.setArtificerTime(time);
artificerTime.setArtificerId(artificerId);
artificerTime.setClassify(2);
artificerTime.setCreateTime(DateUtils.format(new Date()));
artificerTimeDao.insert(artificerTime);
}
}
}
}
}
private Map<String,List> getIdelMap(String startDateStr, String endDateStr){
Map<String,List> map = new HashMap();
Date startDate = DateUtils.stringToDate(startDateStr,"yyyy-MM-dd HH:mm");
Date endDate = DateUtils.stringToDate(endDateStr,"yyyy-MM-dd HH:mm");
Date current = startDate;
while(current.getTime()<=endDate.getTime()){
String day = DateUtils.format(current,"yyyy-MM-dd");
String time = DateUtils.format(current,"HH:mm");
if(map.get(day)!=null){
List<String> timeList = map.get(day);
timeList.add(time);
}else{
List<String> timeList = new ArrayList<>();
timeList.add(time);
map.put(day,timeList);
}
current = DateUtils.addDateMinutes(current,30);
}
return map;
}
private Map<String,List> getBusyMap(Map<String,List> dateMap){
Map<String,List> map = new HashMap();
for (String key : dateMap.keySet()) {
List<String> timeList = dateMap.get(key);
Map<String,String> allTimes = getTimeMap();
for(int i=0; i < timeList.size();i++){
String time = timeList.get(i);
if(allTimes.get(time)!=null){
allTimes.remove(time);
}
}
List<String> keyList = allTimes.keySet().stream().collect(Collectors.toList());
Collections.sort(keyList);
map.put(key,keyList);
}
return map;
}
private Map getTimeMap(){
Map<String,String> map = new HashMap();
for(int i=0;i<24;i++){
String s = "";
if(i<10){
s = "0"+i+":";
}else{
s = i+":";
}
map.put(s+"00",s+"00");
map.put(s+"30",s+"30");
}
return map;
}
}

View File

@ -18,61 +18,33 @@ public class WXConfigUtil implements WXPayConfig {
private String appId = "";
private String key = "";
private String mchId = "";
//初始化加载证书
public WXConfigUtil() throws Exception {
/*int byteread = 0;
int bytesum = 0;
URL url = new URL("windine.blogdriver.com/logo.gif");
*//*String certPath = ClassUtils.getDefaultClassLoader().getResource("").getPath()+"/weixin/apiclient_cert.p12";//从微信商户平台下载的安全证书存放的路径*//*
URLConnection conn = url.openConnection();
InputStream inStream = conn.getInputStream();
FileOutputStream fs = new FileOutputStream(" /www/wwwroot/"+profileHttpUrl+"/file/uploadPath");
byte[] buffer = new byte[1204];
int length;
while ((byteread = inStream.read(buffer)) != -1) {
bytesum += byteread;
fs.write(buffer, 0, byteread);
}*/
ClassPathResource classPathResource = new ClassPathResource("weixin/apiclient_cert.p12");
InputStream certStream = classPathResource.getInputStream();
this.certData = IOUtils.toByteArray(certStream);
certStream.read(this.certData);
certStream.close();
// File file = new File(" ");
/*InputStream certStream = new FileInputStream(file);
this.certData = new byte[(int) file.length()];
certStream.read(this.certData);
certStream.close();*/
}
@Override
public String getAppID() {
return this.appId;
}
@Override
public String getMchID() {
return this.mchId;
}
@Override
public InputStream getCertStream() {
ByteArrayInputStream certBis = new ByteArrayInputStream(this.certData);
return certBis;
}
@Override
public int getHttpConnectTimeoutMs() {
return 8000;
}
@Override
public int getHttpReadTimeoutMs() {
return 10000;
}
}

View File

@ -53,6 +53,10 @@
update bl_massage_package set is_newer=#{isNewer} where id=#{id}
</update>
<update id="updateTj" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
update bl_massage_package set is_tj=#{isTj} where id=#{id}
</update>
<update id="updateStatus" parameterType="com.sqx.modules.bl.massage.entity.MassagePackage">
update bl_massage_package set status=#{status} where id=#{id}
</update>
@ -90,6 +94,9 @@
<if test="params.type!=null">
and a.type = #{params.type}
</if>
<if test="params.isTj!=null">
and a.is_tj = #{params.isTj}
</if>
union all
select massage_type_id as id,title,classify_id as type,b.value as type_name,old_price,price,massage_img,jianjie,content_img,add_num,sales,labels,'项目' as flag,1 as is_can_coupon,1 as is_can_vip,
1 as service_count, 0 as level
@ -109,6 +116,9 @@
<if test="params.type!=null and params.type!=1">
and a.massage_type_id = 0
</if>
<if test="params.isTj!=null">
and a.is_tj = #{params.isTj}
</if>
order by sales desc,id asc
</select>

View File

@ -30,6 +30,8 @@
a.pls,
a.type,
a.pic_path,
a.status,
a.opinion,
b.artificer_id as create_by,
b.artificer_name as artificer_name,
b.artificer_img AS artificerImg,
@ -43,6 +45,12 @@
<if test="params.createBy!=null and params.createBy!=''">
and a.create_by = #{params.createBy}
</if>
<if test="params.status!=null and params.status!=''">
and a.status = #{params.status}
</if>
<if test="params.artificerName!=null and params.artificerName!=''">
and b.artificer_name like concat('%',#{params.artificerName},'%')
</if>
</where>
<if test="params.longitude!=null and params.longitude!='' and params.latitude!=null and params.latitude!=''">
order by (st_distance (point (b.longitude, b.latitude),point(#{params.longitude},#{params.longitude}) ) *111195) asc,a.create_time desc
@ -52,4 +60,13 @@
</if>
</select>
<update id="approve" parameterType="com.sqx.modules.shipinquan.entity.BlShipinquan">
update bl_shipinquan
set status=#{status},
opinion=#{opinion},
approve_time=#{approveTime},
approve_user=#{approveUser}
where id=#{id}
</update>
</mapper>