添加照片比对
This commit is contained in:
parent
f7cdf0bfa9
commit
1b5e035686
12
pom.xml
12
pom.xml
|
@ -427,6 +427,18 @@
|
|||
<version>0.3.7.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baidu.aip</groupId>
|
||||
<artifactId>java-sdk</artifactId>
|
||||
<version>4.16.16</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!--<dependency>-->
|
||||
<!--<groupId>com.baidu.aip</groupId>-->
|
||||
<!-- <artifactId>java-sdk</artifactId>-->
|
||||
|
|
|
@ -444,7 +444,7 @@ public class ArtificerController {
|
|||
}
|
||||
|
||||
@GetMapping("/selectArtificerMoneyList")
|
||||
@ApiOperation("技师收益排行榜")
|
||||
@ApiOperation("技师收益排行榜(在线时长+业绩++加钟率+充值率)")
|
||||
public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId){
|
||||
return artificerService.selectArtificerMoneyList(page, limit, startTime, endTime, title,classifyId);
|
||||
}
|
||||
|
|
|
@ -136,4 +136,5 @@ public interface OrdersDao extends BaseMapper<Orders> {
|
|||
List<Orders> getZxscList(Long userId, String startTime, String endTime);
|
||||
|
||||
List<Orders> getParentOrders(Long parentId);
|
||||
|
||||
}
|
|
@ -139,6 +139,8 @@ public class Artificer implements Serializable {
|
|||
*/
|
||||
private Integer technicianType;
|
||||
|
||||
private String bdxsl;//比对相似率
|
||||
|
||||
/**
|
||||
* 技师类型描述
|
||||
*/
|
||||
|
|
|
@ -12,6 +12,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sqx.common.utils.*;
|
||||
import com.sqx.face.FaceMain;
|
||||
import com.sqx.map.CommonMapUtils;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
|
@ -22,6 +23,7 @@ import com.sqx.modules.artificer.service.ArtificerTimeService;
|
|||
import com.sqx.modules.artificer.service.CollectArtificerService;
|
||||
import com.sqx.modules.common.dao.CommonInfoDao;
|
||||
import com.sqx.modules.common.service.CommonInfoService;
|
||||
import com.sqx.modules.file.utils.FileUploadUtils;
|
||||
import com.sqx.modules.message.entity.MessageInfo;
|
||||
import com.sqx.modules.message.service.MessageService;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
|
@ -65,6 +67,9 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
@Autowired
|
||||
private CommonInfoDao commonInfoDao;
|
||||
|
||||
@Autowired
|
||||
private FaceMain faceMain;
|
||||
|
||||
@Override
|
||||
public Result selectArtificerList(Integer page, Integer limit, Long massageTypeId,String artificerName,
|
||||
String longitude,String latitude,Integer sort,Integer authentication,
|
||||
|
@ -520,7 +525,45 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
|
||||
@Override
|
||||
public Result selectArtificerMoneyList(Integer page,Integer limit,String startTime,String endTime,String title,String classifyId){
|
||||
return Result.success().put("data",new PageUtils(baseMapper.selectArtificerMoneyList(new Page<>(page,limit),startTime,endTime,title,classifyId)));
|
||||
IPage<Map<String,Object>> pageList = baseMapper.selectArtificerMoneyList(new Page<>(page,limit),startTime,endTime,title,classifyId);
|
||||
for(Map<String,Object> map:pageList.getRecords()){
|
||||
Long artificerId = Long.parseLong(map.get("artificerId").toString());
|
||||
//当期业绩
|
||||
Integer currentPerformance = ordersDao.selectOrdersArtificerIntegralEarnings(artificerId, endTime, startTime);
|
||||
map.put("yj",String.valueOf(currentPerformance));
|
||||
|
||||
//当期订单数:计算订单发生了按摩行为的订单数,订单状态经历了开始服务到订单结束。
|
||||
String currentPeriodOrdersSum = ordersDao.selectOrdersArtificerIntegral(artificerId, endTime, startTime);
|
||||
BigDecimal currentPeriodOrdersSumBig = new BigDecimal(currentPeriodOrdersSum);
|
||||
|
||||
//当期加钟率:本周期内,加钟数/本单数
|
||||
String v = ordersDao.selectOrdersArtificerIntegraladdNum(artificerId, endTime, startTime);
|
||||
//加钟数
|
||||
BigDecimal currentPeriodAddBellsSumBig = new BigDecimal(v);
|
||||
//加钟率
|
||||
BigDecimal clockRate = BigDecimal.ZERO;
|
||||
//充值率
|
||||
BigDecimal divide1 = BigDecimal.ZERO;
|
||||
if (currentPeriodOrdersSumBig.compareTo(new BigDecimal("0")) != 0) {
|
||||
clockRate = currentPeriodAddBellsSumBig.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//加钟率
|
||||
|
||||
//当前周期充值率(本周期内充值订单数/本单数)
|
||||
String currentPeriodRechargeSum = ordersDao.selectOrdersCurrentPeriodRechargeSum(artificerId, endTime, startTime);
|
||||
BigDecimal c = new BigDecimal(currentPeriodRechargeSum);
|
||||
divide1 = c.divide(currentPeriodOrdersSumBig, 2, RoundingMode.HALF_UP);//充值率
|
||||
} else {
|
||||
clockRate = new BigDecimal("0");
|
||||
divide1 = new BigDecimal("0");
|
||||
}
|
||||
map.put("jzl",String.valueOf(clockRate));//加钟率
|
||||
map.put("czl",String.valueOf(divide1));//充值率
|
||||
//在线时长
|
||||
String mint = ordersDao.selectOrdersZxscNum(artificerId,startTime,endTime);
|
||||
map.put("zxsc",String.valueOf(mint));//充值率
|
||||
|
||||
}
|
||||
|
||||
return Result.success().put("data",pageList);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -722,6 +765,57 @@ public class ArtificerServiceImpl extends ServiceImpl<ArtificerDao, Artificer> i
|
|||
@Override
|
||||
public Result updateShz(Artificer artificer) {
|
||||
if(artificer.getArtificerId()!=null){
|
||||
|
||||
try {
|
||||
if(StringUtils.isNotEmpty(artificer.getLifePhoto())){
|
||||
String lifePhoto = artificer.getLifePhoto();//生活照
|
||||
if(artificer.getLifePhoto().indexOf(",")>-1){
|
||||
lifePhoto = artificer.getLifePhoto().split(",")[0];
|
||||
}
|
||||
Artificer artificerPar = baseMapper.selectById(artificer.getArtificerId());
|
||||
String artificerImg = artificerPar.getArtificerImg();//头像
|
||||
|
||||
log.error("---------图片----------生活照:"+lifePhoto);
|
||||
log.error("---------图片----------头像照:"+artificerImg);
|
||||
String base64Img1 = FileUploadUtils.convertToBase64(lifePhoto);
|
||||
String base64Img2 = FileUploadUtils.convertToBase64(artificerImg);
|
||||
log.error("---------base64----------生活照:"+base64Img1);
|
||||
log.error("---------base64----------头像照:"+base64Img2);
|
||||
|
||||
|
||||
faceMain.runFlag();
|
||||
//对比
|
||||
org.json.JSONObject res = faceMain.matchBySystemFileUrl(base64Img1,base64Img2,false);
|
||||
log.error("---------res----------:"+res);
|
||||
|
||||
faceMain.runFlag();
|
||||
if(res == null){
|
||||
faceMain.delRunFlag();
|
||||
return Result.error("对比接口调用失败!");
|
||||
}
|
||||
|
||||
//判断是否调用成功
|
||||
Integer errorCode = res.getInt("error_code");
|
||||
String errorMsg = res.getString("error_msg");
|
||||
if(errorCode != 0){
|
||||
faceMain.delRunFlag();
|
||||
return Result.error("对比失败:" + errorMsg + ",错误码为:" + errorCode + "!");
|
||||
}
|
||||
|
||||
//保存结果
|
||||
org.json.JSONObject result = res.getJSONObject("result");
|
||||
log.error("---------result----------:"+result);
|
||||
|
||||
String score = String.valueOf(result.getInt("score"));
|
||||
System.out.println("--------score-----------------:"+score);
|
||||
artificer.setBdxsl(score);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
artificer.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||
baseMapper.updateById(artificer);
|
||||
return Result.success();
|
||||
|
|
|
@ -11,6 +11,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Base64;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
|
@ -241,4 +244,17 @@ public class FileUploadUtils
|
|||
}
|
||||
return extension;
|
||||
}
|
||||
|
||||
public static String convertToBase64(String imagePath) {
|
||||
String base64Image = "";
|
||||
try {
|
||||
Path path = Paths.get(imagePath);
|
||||
byte[] imageBytes = Files.readAllBytes(path);
|
||||
base64Image = Base64.getEncoder().encodeToString(imageBytes);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return base64Image;
|
||||
}
|
||||
|
||||
}
|
|
@ -1037,7 +1037,13 @@
|
|||
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.end_times BETWEEN #{startDate} and #{endDate}
|
||||
<if test="startDate!=null and startDate !=''">
|
||||
and o.end_times >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null and endDate !=''">
|
||||
and o.end_times <= #{endDate}
|
||||
</if>
|
||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate}-->
|
||||
and o.status in (3,5)
|
||||
</select>
|
||||
<!-- 订单数-->
|
||||
|
@ -1049,7 +1055,13 @@
|
|||
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.end_times BETWEEN #{startDate} and #{endDate}
|
||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate}-->
|
||||
<if test="startDate!=null and startDate !=''">
|
||||
and o.end_times >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null and endDate !=''">
|
||||
and o.end_times <= #{endDate}
|
||||
</if>
|
||||
and o.status in (3,5)
|
||||
and o.parent_id = 0
|
||||
</select>
|
||||
|
@ -1062,7 +1074,14 @@
|
|||
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.end_times BETWEEN #{startDate} and #{endDate} and o.parent_id = 0
|
||||
<if test="startDate!=null and startDate !=''">
|
||||
and o.end_times >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null and endDate !=''">
|
||||
and o.end_times <= #{endDate}
|
||||
</if>
|
||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate} -->
|
||||
and o.parent_id = 0
|
||||
</select>
|
||||
<!-- 充值率-->
|
||||
<select id="selectOrdersCurrentPeriodRechargeSum" resultType="java.lang.String">
|
||||
|
@ -1074,7 +1093,14 @@
|
|||
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.end_times BETWEEN #{startDate} and #{endDate} and o.parent_id = 0
|
||||
<if test="startDate!=null and startDate !=''">
|
||||
and o.end_times >= #{startDate}
|
||||
</if>
|
||||
<if test="endDate!=null and endDate !=''">
|
||||
and o.end_times <= #{endDate}
|
||||
</if>
|
||||
<!-- and o.end_times BETWEEN #{startDate} and #{endDate} -->
|
||||
and o.parent_id = 0
|
||||
and uu.type = 2
|
||||
</select>
|
||||
<!-- 储值积分数-->
|
||||
|
@ -1122,8 +1148,13 @@
|
|||
<select id="selectOrdersZxscNum" resultType="java.lang.String">
|
||||
select IFNULL( SUM(user_recharge),0) AS zxsc from bl_user_zxsc
|
||||
where artificer_id = #{artificerId}
|
||||
and create_time >= #{startTime}
|
||||
and create_time <= #{endTime}
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="startTime!=null and startTime!=''">
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
|
||||
</select>
|
||||
|
||||
<select id="selectTjpriceList" resultType="java.lang.String">
|
||||
|
|
Loading…
Reference in New Issue