LAPTOP-KB9HII50\70708 2 jaren geleden
bovenliggende
commit
c9951d24b9

+ 18 - 0
server/svr-authentication/src/main/java/com/yihu/jw/security/oauth2/provider/endpoint/WlyyLoginEndpoint.java

@ -302,6 +302,24 @@ public class WlyyLoginEndpoint extends AbstractEndpoint {
                String data[] = encdata.split(":");
                username = data[1];
                parameters.put("username", username);
            }else if("dingTalk".equals(flag)){
                //钉钉免登录
                parameters.put("grant_type", "dingTalk");
                String authCode = parameters.get("authCode");
                if(org.apache.commons.lang3.StringUtils.isBlank(authCode)){
                    throw new InvalidRequestException("请求参数错误");
                }
                String registerRes= httpClientUtil.get("http://127.0.0.1:10301/doctor/dingtalk_app_user?authCode="+authCode,"UTF-8");
                JSONObject jsonObject= JSONObject.parseObject(registerRes);
                if (jsonObject.getInteger("status") == 200){
                    parameters.put("username", jsonObject.getString("message"));
                }else{
                    HttpHeaders headers = new HttpHeaders();
                    headers.set("Cache-Control", "no-store");
                    headers.set("Pragma", "no-cache");
                    Oauth2Envelop<WlyyUserSimple> oauth2Envelop = new Oauth2Envelop<>(jsonObject.getString("message"), -1, null);
                    return new ResponseEntity<>(oauth2Envelop, headers, HttpStatus.OK);
                }
            }else if (StringUtils.isEmpty(parameters.get("captcha"))) {
                parameters.put("grant_type", "password");
                //解密密码

+ 13 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/BaseDeviceFaceRecordDao.java

@ -0,0 +1,13 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BaseDeviceFaceRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2022/6/2.
 */
public interface BaseDeviceFaceRecordDao extends PagingAndSortingRepository<BaseDeviceFaceRecordDO,String>,
        JpaSpecificationExecutor<BaseDeviceFaceRecordDO> {
}

+ 21 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/dao/device/BaseDevicePatientFaceDao.java

@ -0,0 +1,21 @@
package com.yihu.jw.care.dao.device;
import com.yihu.jw.entity.care.device.BaseDevicePatientFaceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2022/6/1.
 */
public interface BaseDevicePatientFaceDao  extends PagingAndSortingRepository<BaseDevicePatientFaceDO,String>,
        JpaSpecificationExecutor<BaseDevicePatientFaceDO> {
    @Query("select a from BaseDevicePatientFaceDO a where a.idcard = ?1")
    BaseDevicePatientFaceDO findByIdcard(String idcard);
    @Query("select a from BaseDevicePatientFaceDO a where a.type = ?1")
    List<BaseDevicePatientFaceDO> findListByType(Integer type);
}

+ 18 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/admin/CommonEndpoint.java

@ -1,13 +1,16 @@
package com.yihu.jw.care.endpoint.admin;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.label.BaseCapacityLabelDao;
import com.yihu.jw.care.service.common.CommomService;
import com.yihu.jw.care.service.device.DevicePatientFaceService;
import com.yihu.jw.care.service.patient.CarePatientService;
import com.yihu.jw.care.util.DingdingUtil;
import com.yihu.jw.entity.base.patient.BasePatientDO;
import com.yihu.jw.entity.care.label.BaseCapacityLabelDO;
import com.yihu.jw.patient.dao.BasePatientDao;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ObjEnvelop;
import com.yihu.jw.restmodel.web.endpoint.EnvelopRestEndpoint;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -50,6 +53,21 @@ public class CommonEndpoint extends EnvelopRestEndpoint {
    private DingdingUtil dingdingUtil;
    @Autowired
    private CarePatientService carePatientService;
    @Autowired
    private DevicePatientFaceService patientFaceService;
    @GetMapping(value = "open/findFaceRecord")
    @ApiOperation(value = "获取人脸数据")
    public ObjEnvelop findFaceRecord(String patient, String day) {
        try {
            JSONObject json = new JSONObject();
            patientFaceService.findFaceRecord(patient,day,json);
            return ObjEnvelop.getSuccess("初始化成功",json);
        } catch (Exception e) {
            return failedObjEnvelopException2(e);
        }
    }
    @GetMapping(value = "open/initOldTmp2")
    @ApiOperation(value = "初始化签约老人")

+ 46 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/DevicePatientFaceService.java

@ -0,0 +1,46 @@
package com.yihu.jw.care.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.care.dao.device.BaseDeviceFaceRecordDao;
import com.yihu.jw.care.dao.device.BaseDevicePatientFaceDao;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
 * Created by yeshijie on 2022/6/2.
 */
@Service
public class DevicePatientFaceService {
    @Autowired
    private BaseDevicePatientFaceDao patientFaceDao;
    @Autowired
    private BaseDeviceFaceRecordDao faceRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 获取人脸数据
     * @param patient
     * @param day
     * @param result
     */
    public void findFaceRecord(String patient, String day, JSONObject result){
        if(StringUtils.isBlank(day)){
            return;
        }
        String start = day +" 00:00:00";
        String end = day +" 23:59:59";
        String sql = "SELECT img,pass_time passTime from base_device_face_record r where r.patient = ?" +
                "and r.pass_time>=? and r.pass_time<=?" +
                "ORDER BY r.pass_time desc ";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql,new Object[]{patient,start,end});
        result.put("faceRecord",list);
    }
}

+ 3 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/device/PatientDeviceService.java

@ -98,6 +98,8 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
    private BaseEmergencyWarnLogDao logDao;
    @Autowired
    private PatientSafeAreaDao patientSafeAreaDao;
    @Autowired
    private DevicePatientFaceService patientFaceService;
    //健康问题 高血压
    private static final String gxy = "HP0093";
@ -1145,6 +1147,7 @@ public class PatientDeviceService extends BaseJpaService<DevicePatientDevice, Pa
                case "18"://日常用水监测
                    break;
                case "19": //门禁 todo 出入记录
                    patientFaceService.findFaceRecord(patient,day,devInfoObj);
                    break;
                case "20": //电表 todo 日常用电情况
                    break;

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/endpoint/NetdevTestController.java

@ -193,7 +193,7 @@ public class NetdevTestController extends BaseController {
    @ApiOperation("同步人脸数据")
    public String synPatientFaceRecords(){
        try {
            netDevSdkService.synPatientFaceRecords();
//            netDevSdkService.synPatientFaceRecords();
            return success();
        }catch (Exception e){
            e.printStackTrace();

+ 1 - 1
svr/svr-cloud-device/src/main/java/com/yihu/jw/care/netdevsdk/NetDevSdkService.java

@ -337,7 +337,7 @@ public class NetDevSdkService {
            }
            logger.info(name+",startTime="+startTime+",endTime="+endTime);
            NETDEV_ALARM_LOG_COND_LIST_S stFindCond = new NETDEV_ALARM_LOG_COND_LIST_S();
            stFindCond.dwPageRow = 16;
            stFindCond.dwPageRow = 5;
            stFindCond.dwFirstRow = 0;
            stFindCond.dwCondSize = 5;