长庆项目10.25

This commit is contained in:
ovo 2024-10-25 14:58:17 +08:00
parent 6fea9672af
commit ca1ca75079
8 changed files with 92 additions and 41 deletions

View File

@ -32,7 +32,7 @@ import javax.annotation.PostConstruct;
@EnableFeignClients @EnableFeignClients
//@MapperScan("net.shapelight.modules.sys.dao") //@MapperScan("net.shapelight.modules.sys.dao")
public class AdminApplication { public class AdminApplication {
/*@Autowired /* @Autowired
CxFeignClient cxFeignClient;*/ CxFeignClient cxFeignClient;*/
public static void main(String[] args) { public static void main(String[] args) {
@ -64,7 +64,7 @@ public class AdminApplication {
/*@PostConstruct /*@PostConstruct
void init() throws Exception { void init() throws Exception {
SslUtils.ignoreSsl(); 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; CxFeignConfig.token = res;
}*/ }*/

View File

@ -18,6 +18,7 @@ public class CxFeignConfig implements RequestInterceptor {
@Override @Override
public void apply(RequestTemplate requestTemplate) { public void apply(RequestTemplate requestTemplate) {
requestTemplate.header("Bearer ", token); requestTemplate.header("Authorization",
"Bearer "+ token);
} }
} }

View File

@ -326,6 +326,7 @@ public class HttpApiController {
return res; return res;
} }
log.debug("单个获取:"+sn); log.debug("单个获取:"+sn);
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
// SysDeviceEntity sysDeviceEntity = sysDeviceService.getBySn(sn); // SysDeviceEntity sysDeviceEntity = sysDeviceService.getBySn(sn);
//----------------------------------------以下业务----------------------------------------------------- //----------------------------------------以下业务-----------------------------------------------------
@ -335,6 +336,11 @@ public class HttpApiController {
TenCellEntity cellEntity = tenCellService.getById(deviceEntity.getCellId()); TenCellEntity cellEntity = tenCellService.getById(deviceEntity.getCellId());
TenPersonEntity p = tenPersonService.getById(uid,cellEntity.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){ if(p == null || p.getDeleteFlag().intValue() == 1){
return R.error("人员不存在"); return R.error("人员不存在");
} }
@ -455,10 +461,11 @@ public class HttpApiController {
puser.setIsProtectDevice(p.getIsProtectDevice()); puser.setIsProtectDevice(p.getIsProtectDevice());
puser.setIsEnterSulfurArea(p.getIsEnterSulfurArea()); puser.setIsEnterSulfurArea(p.getIsEnterSulfurArea());
puser.setIsWatchSafeVideo(p.getIsWatchSafeVideo()); puser.setIsWatchSafeVideo(p.getIsWatchSafeVideo());
List<TenPersonCert> tenPersonCertList = certService.list(new LambdaQueryWrapper<TenPersonCert>() List<TenPersonCert> tenPersonCertList = certService.list(new LambdaQueryWrapper<TenPersonCert>()
.eq(TenPersonCert::getPerson,p.getPersonId())); .eq(TenPersonCert::getPerson,p.getOpenId()));
List<TenPersonTrain> tenPersonTrainList = trainService.list(new LambdaQueryWrapper<TenPersonTrain>() List<TenPersonTrain> tenPersonTrainList = trainService.list(new LambdaQueryWrapper<TenPersonTrain>()
.eq(TenPersonTrain::getPersonId,p.getPersonId())); .eq(TenPersonTrain::getPersonId,p.getOpenId()));
puser.setTenPersonCertList(tenPersonCertList); puser.setTenPersonCertList(tenPersonCertList);
puser.setTenPersonTrainList(tenPersonTrainList); puser.setTenPersonTrainList(tenPersonTrainList);
@ -468,6 +475,12 @@ public class HttpApiController {
syncEntity.setState(Constant.PERSON_SYNC_OK); syncEntity.setState(Constant.PERSON_SYNC_OK);
tenPersonSyncService.updateById(syncEntity); tenPersonSyncService.updateById(syncEntity);
if(puser.getUser_name().equals("")){
System.out.println("puser = " + puser);
}
return R.ok().put("data",puser); return R.ok().put("data",puser);
} }
@ -2109,6 +2122,9 @@ public class HttpApiController {
@PostMapping("/role") @PostMapping("/role")
public R roleList(@Param(value = "sn")String sn) { 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)); return R.ok().put("data",cqEnterService.queryByCellId(sn));
} }
} }

View File

@ -60,9 +60,6 @@ public class CqEnterController {
public R demo(String operator, Long cellId){ public R demo(String operator, Long cellId){
return R.ok() return R.ok()
.put("data", cqEnterService.list(operator, cellId)) .put("data", cqEnterService.list(operator, cellId))
.put("total", cqEnterService.list(operator, cellId).size()); .put("total", cqEnterService.list(operator, cellId).size());

View File

@ -63,14 +63,14 @@ public class CqSafeVideoController {
@GetMapping("/list") @GetMapping("/list")
@ApiOperation(value = "列表视频接口") @ApiOperation(value = "列表视频接口")
public R list(@RequestParam(defaultValue = "1") int page, 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) Long cellId,
@RequestParam(required = false) String videoName, @RequestParam(required = false) String videoName,
@RequestParam(required = false) String uploadName) { @RequestParam(required = false) String uploadName) {
return R.ok() return R.ok()
.put("data", cqSafeVideoService.list(page, size, cellId, .put("data", cqSafeVideoService.list(page, limit, cellId,
videoName, uploadName)) videoName, uploadName))
.put("total", cqSafeVideoService.list(page, size, cellId, .put("total", cqSafeVideoService.list(page, limit, cellId,
videoName, uploadName).size()); videoName, uploadName).size());
} }

View File

@ -152,7 +152,8 @@ public class CqEnterServiceImpl {
public List<CellRuleVo> queryByCellId(String sn) { public List<CellRuleVo> queryByCellId(String sn) {
return cqEnterConfigTypeMapper.selectJoinList(CellRuleVo.class, return cqEnterConfigTypeMapper.selectJoinList(CellRuleVo.class,
new MPJLambdaWrapper<TenEnterConfigType>() new MPJLambdaWrapper<TenEnterConfigType>()
.select(TenEnterConfigType::getEnterConfigId, TenEnterConfigType::getTypeId, TenEnterConfigType::getState) .select(TenEnterConfigType::getEnterConfigId, TenEnterConfigType::getTypeId,
TenEnterConfigType::getState)
.selectAs(TenEnterConfigEntity::getCheckItem, CellRuleVo::getConfigName) .selectAs(TenEnterConfigEntity::getCheckItem, CellRuleVo::getConfigName)
.leftJoin(TenEnterConfigEntity.class, TenEnterConfigEntity::getId, TenEnterConfigType::getEnterConfigId) .leftJoin(TenEnterConfigEntity.class, TenEnterConfigEntity::getId, TenEnterConfigType::getEnterConfigId)
.eq(TenEnterConfigType::getCellId, tenDeviceMapper.selectOne(new QueryWrapper<TenDeviceEntity>() .eq(TenEnterConfigType::getCellId, tenDeviceMapper.selectOne(new QueryWrapper<TenDeviceEntity>()

View File

@ -71,21 +71,26 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
@Override @Override
public void run(String params) { public void run(String params) {
try {
//getPmInternalPersonnelList("Person");
//getPmInternalPersonnelList("Contractor");
try {
getPmInternalPersonnelList("Person"); getPmInternalPersonnelList("Person");
} catch (Exception e) { } catch (Exception e) {
// 处理异常比如记录日志 // 处理异常比如记录日志
System.err.println("Error while fetching personnel list for Person: " + e.getMessage()); System.err.println("Error while fetching personnel list for Person: " + e.getMessage());
} }
try { try {
getPmInternalPersonnelList("Contractor"); getPmInternalPersonnelList("Contractor");
} catch (Exception e) { } catch (Exception e) {
// 处理异常比如记录日志 // 处理异常比如记录日志
System.err.println("Error while fetching personnel list for Contractor: " + e.getMessage()); System.err.println("Error while fetching personnel list for Contractor: " + e.getMessage());
} }
try { try {
getPmInternalPersonnelList("Supplier"); getPmInternalPersonnelList("Supplier");
} catch (Exception e) { } catch (Exception e) {
// 处理异常比如记录日志 // 处理异常比如记录日志
@ -101,8 +106,11 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("pageIndex", pageIndex); params.put("pageIndex", pageIndex);
params.put("pageSize", 1000); params.put("pageSize", 1000);
params.put("orgName", item.getName()); /* params.put("orgName", item.getName());*/
params.put("orgId", item.getCellId()); /*params.put("orgId", item.getCellId());*/
params.put("orgId", item.getOrgId());
JSONObject jsonOne; JSONObject jsonOne;
if (type.equals("Person")) { if (type.equals("Person")) {
jsonOne = cxFeignClient.getPmInternalPersonnelList(params); jsonOne = cxFeignClient.getPmInternalPersonnelList(params);
@ -119,23 +127,26 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
// 获取total字段 // 获取total字段
int total = dataObject.getInt("total"); int total = dataObject.getInt("total");
System.out.println("total = " + total);
if (total > 0) { if (total > 0) {
for (int i = 0; i < total / 20; i++) { for (int i = 0; i <= total / 20; i++) {
Map<String, Object> params2 = new HashMap<>(); Map<String, Object> params2 = new HashMap<>();
params2.put("pageIndex", i); params2.put("pageIndex", (i + 1));
params2.put("pageSize", 20); params2.put("pageSize", 20);
params2.put("orgName", item.getName()); /*params2.put("orgName", item.getName());*/
params2.put("orgId", item.getCellId()); params2.put("orgId", item.getOrgId());
JSONObject json = null; JSONObject json = null;
if (type.equals("Person")) { if (type.equals("Person")) {
json = cxFeignClient.getPmInternalPersonnelList(params); json = cxFeignClient.getPmInternalPersonnelList(params2);
} else if (type.equals("Contractor")) { } else if (type.equals("Contractor")) {
json = cxFeignClient.getPmContractorDataList(params); json = cxFeignClient.getPmContractorDataList(params2);
} else { } else {
json = cxFeignClient.getPmSupplierDataList(params); json = cxFeignClient.getPmSupplierDataList(params2);
} }
if (json.getBool("success") != null && json.getBool("success")) { if (json.getBool("success") != null && json.getBool("success")) {
JSONObject data = json.getJSONObject("data"); JSONObject data = json.getJSONObject("data");
System.out.println("cssssssssssssssssssssss" + data);
JSONArray dataList = data.getJSONArray("list"); JSONArray dataList = data.getJSONArray("list");
List<JSONObject> list1 = dataList.toList(JSONObject.class); List<JSONObject> list1 = dataList.toList(JSONObject.class);
String filePath = "C:\\zhihuiyuanqu\\firePerson.txt"; String filePath = "C:\\zhihuiyuanqu\\firePerson.txt";
@ -149,6 +160,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
// 写入数据 // 写入数据
list1.forEach(person -> { list1.forEach(person -> {
String msg = save(person, item); String msg = save(person, item);
System.out.println("msg = " + msg);
if (!msg.isEmpty()) { if (!msg.isEmpty()) {
try { try {
writer.write(msg); writer.write(msg);
@ -181,7 +193,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("pageIndex", pageIndex); params.put("pageIndex", pageIndex);
params.put("pageSize", 1000); params.put("pageSize", 1000);
params.put("orgName", item.getName()); /*params.put("orgName", item.getName());*/
params.put("orgId", item.getOrgId()); params.put("orgId", item.getOrgId());
// //
@ -296,7 +308,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
Map<String, Object> params2 = new HashMap<>(); Map<String, Object> params2 = new HashMap<>();
params2.put("pageIndex", i); params2.put("pageIndex", i);
params2.put("pageSize", 20); params2.put("pageSize", 20);
params2.put("orgName", item.getName()); /*params2.put("orgName", item.getName());*/
params2.put("orgId", item.getOrgId()); params2.put("orgId", item.getOrgId());
JSONObject json = null; JSONObject json = null;
json = jsonOne; json = jsonOne;
@ -343,12 +355,16 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
public String save(JSONObject person, TenCellEntity cellEntity) { public String save(JSONObject person, TenCellEntity cellEntity) {
/*System.out.println("personcscscs= " + person);*/
TenPersonEntity tenPerson = new TenPersonEntity(); TenPersonEntity tenPerson = new TenPersonEntity();
Date now = new Date(); Date now = new Date();
long id = new SnowflakeIdWorker().nextId(); long id = new SnowflakeIdWorker().nextId();
tenPerson.setPersonId(id); tenPerson.setPersonId(id);
tenPerson.setUuid(UUIDUtil.uuid()); tenPerson.setUuid(UUIDUtil.uuid());
tenPerson.setTenantId(cellEntity.getTenantId()); //tenPerson.setTenantId(cellEntity.getTenantId());
tenPerson.setCreateBy("sync"); tenPerson.setCreateBy("sync");
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_FILE); tenPerson.setRegisterType(Constant.RESGISTER_TYPE_FILE);
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR); 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 ? Long.parseLong(UserRamGroup.getOrgCellMap(person.getStr("orgId"))) : null);
/* tenPerson.setCellId(person.getStr("orgId") != null ? /* tenPerson.setCellId(person.getStr("orgId") != null ?
tenCellService.getOne(new QueryWrapper<TenCellEntity>().eq("org_id", person.getStr("orgId"))).getCellId() : null);*/ tenCellService.getOne(new QueryWrapper<TenCellEntity>().eq("org_id", person.getStr("orgId"))).getCellId() : null);*/
tenPerson.setCellId(tenCellService /* tenPerson.setCellId(tenCellService
.getOne(new QueryWrapper<TenCellEntity>() .getOne(new QueryWrapper<TenCellEntity>()
.eq("org_id", cellEntity.getOrgId())).getCellId()); .eq("org_id", cellEntity.getOrgId())).getCellId());*/
tenPerson.setCellId(1L);
/* System.out.println("id = " + id);*/
tenPerson.setOrgId(cellEntity.getOrgId()); tenPerson.setOrgId(cellEntity.getOrgId());
@ -371,6 +392,11 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
tenPerson.setName(person.getStr("contractorName")); tenPerson.setName(person.getStr("contractorName"));
} }
if (person.getStr("personnelName") != null){ if (person.getStr("personnelName") != null){
/* if(person.getStr("personnelName").equals("邢严")){
System.out.println("person水水水水水水水水水水水水水水水水水" + person);
}*/
tenPerson.setName(person.getStr("personnelName")); 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.setIdCard(person.getStr("personnelCardId") != null ? person.getStr("personnelCardId") : null);
tenPerson.setNation(person.getStr("dictNation") != null ? Integer.parseInt(person.getStr("dictNation")) : 1); tenPerson.setNation(person.getStr("dictNation") != null ? Integer.parseInt(person.getStr("dictNation")) : 1);
tenPerson.setCellId(cellEntity.getCellId()); tenPerson.setCellId(cellEntity.getCellId());
tenPerson.setTenantId(getUser().getTenantId());
tenPerson.setTenantId(836266616957173761L);
tenPerson.setRegisterType(Constant.RESGISTER_TYPE_Device); tenPerson.setRegisterType(Constant.RESGISTER_TYPE_Device);
tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR); tenPerson.setStatus(Constant.PESON_SUATUS_NOMOR);
if (person.getStr("pmPersonnelId") != null) { if (person.getStr("pmPersonnelId") != null) {
@ -392,6 +421,9 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
tenPerson.setOpenId(person.getStr("pmSupplierId")); tenPerson.setOpenId(person.getStr("pmSupplierId"));
} }
tenPerson.setOrgId(person.getStr("orgId") != null ? person.getStr("orgId") : null); 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 sfm = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
SimpleDateFormat sfm1 = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sfm1 = new SimpleDateFormat("yyyy-MM-dd");
try { try {
@ -415,10 +447,10 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
tenPerson.setIsProtectDevice(person.getStr("isProtectDevice").equals("") ? 1 : 0); tenPerson.setIsProtectDevice(person.getStr("isProtectDevice").equals("") ? 1 : 0);
} }
if (person.getStr("isWatchSafeVideo") != null) { 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) { 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) { if (person.getStr("belongContractorName") != null) {
tenPerson.setBelongContractorName(person.getStr("belongContractorName")); 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); ? contractorTrain.getStr("theoreticalScore") : null);
personTrain.setPracticeScore(contractorTrain.getStr("practiceScore") != 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) { if (person.getStr("attachment") != null) {
try { try {
@ -639,8 +673,8 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
inputStream.close(); inputStream.close();
tenPerson.setOrgImage(orgImageFileName); tenPerson.setOrgImage(orgImageFileName);
tenPerson.setFaceImage(orgImageFileName); tenPerson.setFaceImage(orgImageFileName);
String flag = tenPersonService.saveOrUpdateByField(tenPerson, "open_id"); // String flag = tenPersonService.saveOrUpdateByField(tenPerson, "open_id");
if (flag.equals("save")) { /* if (flag.equals("save")) {
//发送设备通知 //发送设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(tenPerson.getCellId()); List<TenDeviceVo> devList = tenDeviceService.findByCellId(tenPerson.getCellId());
//状态是0正常发送推送 //状态是0正常发送推送
@ -666,7 +700,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
serverApiService.personOperation(dev.getSn(), list); serverApiService.personOperation(dev.getSn(), list);
} }
} }
} }*/
UserInfo userInfo = new UserInfo(); UserInfo userInfo = new UserInfo();
userInfo.setFaceId(tenPerson.getPersonId().toString()); userInfo.setFaceId(tenPerson.getPersonId().toString());
userInfo.setName(tenPerson.getName()); userInfo.setName(tenPerson.getName());
@ -684,10 +718,12 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
return tenPerson.getOpenId() + "|" + tenPerson.getName() + "|" + "保存照片文件失败"; return tenPerson.getOpenId() + "|" + tenPerson.getName() + "|" + "保存照片文件失败";
} }
} }
if(tenPerson.getIsWatchSafeVideo() == null){
tenPerson.setIsWatchSafeVideo(0);
}
if(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
.eq("open_id", tenPerson.getOpenId())) != null) {
tenPersonService.removeById(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
.eq("open_id", tenPerson.getOpenId())).getMemberId());
}
tenPersonService.saveTenPerson(tenPerson); tenPersonService.saveTenPerson(tenPerson);
System.out.println("新增成功" + tenPerson); System.out.println("新增成功" + tenPerson);
return ""; return "";

View File

@ -67,7 +67,7 @@ public class TenPersonTrain implements Serializable {
/** /**
* 理论成绩 * 理论成绩
*/ */
private String theoreticalScorel; private String theoreticalScore;
/** /**
* 实践成绩 * 实践成绩