From ca1ca7507924418ca25cc308706b5b614d7116b5 Mon Sep 17 00:00:00 2001 From: ovo Date: Fri, 25 Oct 2024 14:58:17 +0800 Subject: [PATCH] =?UTF-8?q?=E9=95=BF=E5=BA=86=E9=A1=B9=E7=9B=AE10.25?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/shapelight/AdminApplication.java | 4 +- .../common/config/CxFeignConfig.java | 3 +- .../httpapi/controler/HttpApiController.java | 20 +++- .../controller/enter/CqEnterController.java | 3 - .../video/CqSafeVideoController.java | 6 +- .../iCq/service/enter/CqEnterServiceImpl.java | 3 +- .../job/task/PersonSynchronousTask.java | 92 +++++++++++++------ .../modules/ten/entity/TenPersonTrain.java | 2 +- 8 files changed, 92 insertions(+), 41 deletions(-) diff --git a/shapelight-admin/src/main/java/net/shapelight/AdminApplication.java b/shapelight-admin/src/main/java/net/shapelight/AdminApplication.java index d65eb85..14464b9 100644 --- a/shapelight-admin/src/main/java/net/shapelight/AdminApplication.java +++ b/shapelight-admin/src/main/java/net/shapelight/AdminApplication.java @@ -32,7 +32,7 @@ import javax.annotation.PostConstruct; @EnableFeignClients //@MapperScan("net.shapelight.modules.sys.dao") public class AdminApplication { - /*@Autowired +/* @Autowired CxFeignClient cxFeignClient;*/ public static void main(String[] args) { @@ -64,7 +64,7 @@ public class AdminApplication { /*@PostConstruct void init() throws Exception { SslUtils.ignoreSsl(); - String res = cxFeignClient.getToken("5bb50ad0cc40e10565089c35aa61e7f3","k9?8bCqaQ*R1e2Wx0f65AzY4^]LDp@_Z"); + String res = cxFeignClient.getToken("5bb50ad0cc40e10565089c35aa61e7f3","k9?8bCqaQ*R1e2Wx0f65AzY4^]LDp@_Z"); CxFeignConfig.token = res; }*/ diff --git a/shapelight-admin/src/main/java/net/shapelight/common/config/CxFeignConfig.java b/shapelight-admin/src/main/java/net/shapelight/common/config/CxFeignConfig.java index b3c0dbe..e43a0e6 100644 --- a/shapelight-admin/src/main/java/net/shapelight/common/config/CxFeignConfig.java +++ b/shapelight-admin/src/main/java/net/shapelight/common/config/CxFeignConfig.java @@ -18,6 +18,7 @@ public class CxFeignConfig implements RequestInterceptor { @Override public void apply(RequestTemplate requestTemplate) { - requestTemplate.header("Bearer ", token); + requestTemplate.header("Authorization", + "Bearer "+ token); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java index 83a7cc6..95ed36d 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/httpapi/controler/HttpApiController.java @@ -326,6 +326,7 @@ public class HttpApiController { return res; } log.debug("单个获取:"+sn); + TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); // SysDeviceEntity sysDeviceEntity = sysDeviceService.getBySn(sn); //----------------------------------------以下业务----------------------------------------------------- @@ -335,6 +336,11 @@ public class HttpApiController { TenCellEntity cellEntity = tenCellService.getById(deviceEntity.getCellId()); TenPersonEntity p = tenPersonService.getById(uid,cellEntity.getCellId()); + + /* if(Objects.equals(p.getName(), "薛")){ + System.out.println("pxxxxxxxxxxxxxxxxxxx = " + p); + }*/ + if(p == null || p.getDeleteFlag().intValue() == 1){ return R.error("人员不存在"); } @@ -455,10 +461,11 @@ public class HttpApiController { puser.setIsProtectDevice(p.getIsProtectDevice()); puser.setIsEnterSulfurArea(p.getIsEnterSulfurArea()); puser.setIsWatchSafeVideo(p.getIsWatchSafeVideo()); + List tenPersonCertList = certService.list(new LambdaQueryWrapper() - .eq(TenPersonCert::getPerson,p.getPersonId())); + .eq(TenPersonCert::getPerson,p.getOpenId())); List tenPersonTrainList = trainService.list(new LambdaQueryWrapper() - .eq(TenPersonTrain::getPersonId,p.getPersonId())); + .eq(TenPersonTrain::getPersonId,p.getOpenId())); puser.setTenPersonCertList(tenPersonCertList); puser.setTenPersonTrainList(tenPersonTrainList); @@ -468,6 +475,12 @@ public class HttpApiController { syncEntity.setState(Constant.PERSON_SYNC_OK); tenPersonSyncService.updateById(syncEntity); + + if(puser.getUser_name().equals("薛")){ + System.out.println("puser = " + puser); + } + + return R.ok().put("data",puser); } @@ -2109,6 +2122,9 @@ public class HttpApiController { @PostMapping("/role") public R roleList(@Param(value = "sn")String sn) { + + System.out.println("cqEnterService.queryByCellId(sn) = " + cqEnterService.queryByCellId(sn)); + return R.ok().put("data",cqEnterService.queryByCellId(sn)); } } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java index e68f4f7..e74049a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/enter/CqEnterController.java @@ -60,9 +60,6 @@ public class CqEnterController { public R demo(String operator, Long cellId){ - - - return R.ok() .put("data", cqEnterService.list(operator, cellId)) .put("total", cqEnterService.list(operator, cellId).size()); diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java index c38bca3..962bd15 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/controller/video/CqSafeVideoController.java @@ -63,14 +63,14 @@ public class CqSafeVideoController { @GetMapping("/list") @ApiOperation(value = "列表视频接口") public R list(@RequestParam(defaultValue = "1") int page, - @RequestParam(defaultValue = "10") int size, + @RequestParam(defaultValue = "10") int limit, @RequestParam(required = false) Long cellId, @RequestParam(required = false) String videoName, @RequestParam(required = false) String uploadName) { return R.ok() - .put("data", cqSafeVideoService.list(page, size, cellId, + .put("data", cqSafeVideoService.list(page, limit, cellId, videoName, uploadName)) - .put("total", cqSafeVideoService.list(page, size, cellId, + .put("total", cqSafeVideoService.list(page, limit, cellId, videoName, uploadName).size()); } diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java index 4048aba..3b32b2c 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/iCq/service/enter/CqEnterServiceImpl.java @@ -152,7 +152,8 @@ public class CqEnterServiceImpl { public List queryByCellId(String sn) { return cqEnterConfigTypeMapper.selectJoinList(CellRuleVo.class, new MPJLambdaWrapper() - .select(TenEnterConfigType::getEnterConfigId, TenEnterConfigType::getTypeId, TenEnterConfigType::getState) + .select(TenEnterConfigType::getEnterConfigId, TenEnterConfigType::getTypeId, + TenEnterConfigType::getState) .selectAs(TenEnterConfigEntity::getCheckItem, CellRuleVo::getConfigName) .leftJoin(TenEnterConfigEntity.class, TenEnterConfigEntity::getId, TenEnterConfigType::getEnterConfigId) .eq(TenEnterConfigType::getCellId, tenDeviceMapper.selectOne(new QueryWrapper() diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java index ff5d352..904e5d2 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/job/task/PersonSynchronousTask.java @@ -71,21 +71,26 @@ public class PersonSynchronousTask extends AbstractController implements ITask { @Override public void run(String params) { - try { + + //getPmInternalPersonnelList("Person"); + + //getPmInternalPersonnelList("Contractor"); + + try { getPmInternalPersonnelList("Person"); } catch (Exception e) { // 处理异常,比如记录日志 System.err.println("Error while fetching personnel list for Person: " + e.getMessage()); } - try { + try { getPmInternalPersonnelList("Contractor"); } catch (Exception e) { // 处理异常,比如记录日志 System.err.println("Error while fetching personnel list for Contractor: " + e.getMessage()); } - try { + try { getPmInternalPersonnelList("Supplier"); } catch (Exception e) { // 处理异常,比如记录日志 @@ -101,8 +106,11 @@ public class PersonSynchronousTask extends AbstractController implements ITask { Map params = new HashMap<>(); params.put("pageIndex", pageIndex); params.put("pageSize", 1000); - params.put("orgName", item.getName()); - params.put("orgId", item.getCellId()); + /* params.put("orgName", item.getName());*/ + /*params.put("orgId", item.getCellId());*/ + params.put("orgId", item.getOrgId()); + + JSONObject jsonOne; if (type.equals("Person")) { jsonOne = cxFeignClient.getPmInternalPersonnelList(params); @@ -119,23 +127,26 @@ public class PersonSynchronousTask extends AbstractController implements ITask { // 获取total字段 int total = dataObject.getInt("total"); + System.out.println("total = " + total); + if (total > 0) { - for (int i = 0; i < total / 20; i++) { + for (int i = 0; i <= total / 20; i++) { Map params2 = new HashMap<>(); - params2.put("pageIndex", i); + params2.put("pageIndex", (i + 1)); params2.put("pageSize", 20); - params2.put("orgName", item.getName()); - params2.put("orgId", item.getCellId()); + /*params2.put("orgName", item.getName());*/ + params2.put("orgId", item.getOrgId()); JSONObject json = null; if (type.equals("Person")) { - json = cxFeignClient.getPmInternalPersonnelList(params); + json = cxFeignClient.getPmInternalPersonnelList(params2); } else if (type.equals("Contractor")) { - json = cxFeignClient.getPmContractorDataList(params); + json = cxFeignClient.getPmContractorDataList(params2); } else { - json = cxFeignClient.getPmSupplierDataList(params); + json = cxFeignClient.getPmSupplierDataList(params2); } if (json.getBool("success") != null && json.getBool("success")) { JSONObject data = json.getJSONObject("data"); + System.out.println("cssssssssssssssssssssss" + data); JSONArray dataList = data.getJSONArray("list"); List list1 = dataList.toList(JSONObject.class); String filePath = "C:\\zhihuiyuanqu\\firePerson.txt"; @@ -149,6 +160,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask { // 写入数据 list1.forEach(person -> { String msg = save(person, item); + System.out.println("msg = " + msg); if (!msg.isEmpty()) { try { writer.write(msg); @@ -181,7 +193,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask { Map params = new HashMap<>(); params.put("pageIndex", pageIndex); params.put("pageSize", 1000); - params.put("orgName", item.getName()); + /*params.put("orgName", item.getName());*/ params.put("orgId", item.getOrgId()); // @@ -296,7 +308,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask { Map params2 = new HashMap<>(); params2.put("pageIndex", i); params2.put("pageSize", 20); - params2.put("orgName", item.getName()); + /*params2.put("orgName", item.getName());*/ params2.put("orgId", item.getOrgId()); JSONObject json = null; json = jsonOne; @@ -343,12 +355,16 @@ public class PersonSynchronousTask extends AbstractController implements ITask { public String save(JSONObject person, TenCellEntity cellEntity) { + + + /*System.out.println("personcscscs= " + person);*/ + TenPersonEntity tenPerson = new TenPersonEntity(); Date now = new Date(); long id = new SnowflakeIdWorker().nextId(); tenPerson.setPersonId(id); tenPerson.setUuid(UUIDUtil.uuid()); - tenPerson.setTenantId(cellEntity.getTenantId()); + //tenPerson.setTenantId(cellEntity.getTenantId()); tenPerson.setCreateBy("sync"); tenPerson.setRegisterType(Constant.RESGISTER_TYPE_FILE); tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR); @@ -358,9 +374,14 @@ public class PersonSynchronousTask extends AbstractController implements ITask { //tenPerson.setCellId(person.getStr("orgId") != null ? Long.parseLong(UserRamGroup.getOrgCellMap(person.getStr("orgId"))) : null); /* tenPerson.setCellId(person.getStr("orgId") != null ? tenCellService.getOne(new QueryWrapper().eq("org_id", person.getStr("orgId"))).getCellId() : null);*/ - tenPerson.setCellId(tenCellService + /* tenPerson.setCellId(tenCellService .getOne(new QueryWrapper() - .eq("org_id", cellEntity.getOrgId())).getCellId()); + .eq("org_id", cellEntity.getOrgId())).getCellId());*/ + + + + tenPerson.setCellId(1L); + /* System.out.println("id = " + id);*/ tenPerson.setOrgId(cellEntity.getOrgId()); @@ -371,6 +392,11 @@ public class PersonSynchronousTask extends AbstractController implements ITask { tenPerson.setName(person.getStr("contractorName")); } if (person.getStr("personnelName") != null){ + + /* if(person.getStr("personnelName").equals("邢严")){ + System.out.println("person水水水水水水水水水水水水水水水水水" + person); + }*/ + tenPerson.setName(person.getStr("personnelName")); } @@ -379,7 +405,10 @@ public class PersonSynchronousTask extends AbstractController implements ITask { tenPerson.setIdCard(person.getStr("personnelCardId") != null ? person.getStr("personnelCardId") : null); tenPerson.setNation(person.getStr("dictNation") != null ? Integer.parseInt(person.getStr("dictNation")) : 1); tenPerson.setCellId(cellEntity.getCellId()); - tenPerson.setTenantId(getUser().getTenantId()); + + + tenPerson.setTenantId(836266616957173761L); + tenPerson.setRegisterType(Constant.RESGISTER_TYPE_Device); tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR); if (person.getStr("pmPersonnelId") != null) { @@ -392,6 +421,9 @@ public class PersonSynchronousTask extends AbstractController implements ITask { tenPerson.setOpenId(person.getStr("pmSupplierId")); } tenPerson.setOrgId(person.getStr("orgId") != null ? person.getStr("orgId") : null); + + /* System.out.println("id = " + id);*/ + SimpleDateFormat sfm = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); SimpleDateFormat sfm1 = new SimpleDateFormat("yyyy-MM-dd"); try { @@ -415,10 +447,10 @@ public class PersonSynchronousTask extends AbstractController implements ITask { tenPerson.setIsProtectDevice(person.getStr("isProtectDevice").equals("是") ? 1 : 0); } if (person.getStr("isWatchSafeVideo") != null) { - tenPerson.setIsWatchSafeVideo(person.getStr("isWatchSafeVideo").equals("是") ? 1 : 0); + tenPerson.setIsWatchSafeVideo(person.getStr("isWatchSafeVideo").equals("未观看") ? 0 : 1); } if (person.getStr("isWatchVideo") != null) { - tenPerson.setIsWatchSafeVideo(person.getStr("isWatchVideo").equals("是") ? 1 : 0); + tenPerson.setIsWatchSafeVideo(person.getStr("isWatchVideo").equals("未观看") ? 0 : 1); } if (person.getStr("belongContractorName") != null) { tenPerson.setBelongContractorName(person.getStr("belongContractorName")); @@ -569,7 +601,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask { } } - personTrain.setTheoreticalScorel(contractorTrain.getStr("theoreticalScore") != null + personTrain.setTheoreticalScore(contractorTrain.getStr("theoreticalScore") != null ? contractorTrain.getStr("theoreticalScore") : null); personTrain.setPracticeScore(contractorTrain.getStr("practiceScore") != null @@ -611,7 +643,9 @@ public class PersonSynchronousTask extends AbstractController implements ITask { }); } - + if(tenPerson.getIsWatchSafeVideo() == null){ + tenPerson.setIsWatchSafeVideo(0); + } if (person.getStr("attachment") != null) { try { @@ -639,8 +673,8 @@ public class PersonSynchronousTask extends AbstractController implements ITask { inputStream.close(); tenPerson.setOrgImage(orgImageFileName); tenPerson.setFaceImage(orgImageFileName); - String flag = tenPersonService.saveOrUpdateByField(tenPerson, "open_id"); - if (flag.equals("save")) { + // String flag = tenPersonService.saveOrUpdateByField(tenPerson, "open_id"); + /* if (flag.equals("save")) { //发送设备通知 List devList = tenDeviceService.findByCellId(tenPerson.getCellId()); //状态是0正常,发送推送 @@ -666,7 +700,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask { serverApiService.personOperation(dev.getSn(), list); } } - } + }*/ UserInfo userInfo = new UserInfo(); userInfo.setFaceId(tenPerson.getPersonId().toString()); userInfo.setName(tenPerson.getName()); @@ -684,10 +718,12 @@ public class PersonSynchronousTask extends AbstractController implements ITask { return tenPerson.getOpenId() + "|" + tenPerson.getName() + "|" + "保存照片文件失败"; } } - if(tenPerson.getIsWatchSafeVideo() == null){ - tenPerson.setIsWatchSafeVideo(0); - } + if(tenPersonService.getOne(new QueryWrapper() + .eq("open_id", tenPerson.getOpenId())) != null) { + tenPersonService.removeById(tenPersonService.getOne(new QueryWrapper() + .eq("open_id", tenPerson.getOpenId())).getMemberId()); + } tenPersonService.saveTenPerson(tenPerson); System.out.println("新增成功" + tenPerson); return ""; diff --git a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java index 630a272..bec316a 100644 --- a/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java +++ b/shapelight-admin/src/main/java/net/shapelight/modules/ten/entity/TenPersonTrain.java @@ -67,7 +67,7 @@ public class TenPersonTrain implements Serializable { /** * 理论成绩 */ - private String theoreticalScorel; + private String theoreticalScore; /** * 实践成绩