diff --git a/src/main/java/com/glxp/api/constant/Constant.java b/src/main/java/com/glxp/api/constant/Constant.java index 7887d34eb..a55bce90b 100644 --- a/src/main/java/com/glxp/api/constant/Constant.java +++ b/src/main/java/com/glxp/api/constant/Constant.java @@ -334,4 +334,7 @@ public class Constant { public static final Integer SK_PRO_DSB_TYPE = 1;//1:定数包,内部使用 public static final Integer SK_PRO_THR_TYPE = 2;//2:项目、组套外部关联 public static final Integer SK_PRO_SS_TYPE = 3;//3:术式组套 + + //密码错误次数 + public static final String PASSWORD_ERROR_COUNT = "PasswordErrorCount"; } diff --git a/src/main/java/com/glxp/api/controller/auth/LoginController.java b/src/main/java/com/glxp/api/controller/auth/LoginController.java index 0c173906c..3b60d9264 100644 --- a/src/main/java/com/glxp/api/controller/auth/LoginController.java +++ b/src/main/java/com/glxp/api/controller/auth/LoginController.java @@ -62,7 +62,8 @@ public class LoginController extends BaseController { private CompanyService companyService; @Resource private AuthLicenseDao authLicenseDao; - + @Resource + RedisUtil redisUtil; /** * 用户登录 @@ -82,18 +83,26 @@ public class LoginController extends BaseController { throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); } - log.info(loginRequest.getPassword()); - log.info(PasswordUtils.authAdminPwd(authAdmin.getPassWord())); + //验证错误了几次 + Integer errorCount = (Integer) redisUtil.get(Constant.PASSWORD_ERROR_COUNT + authAdmin.getId()); + if (errorCount == null ){ + errorCount = 0; + }else { + if (errorCount == 5){ + throw new JsonException(ResultEnum.DATA_NOT, "已连续5次输入错误密码,账号被锁定30分钟!"); + } + } if (PasswordUtils.authAdminPwd(loginRequest.getPassword()).equals(PasswordUtils.authAdminPwd(authAdmin.getPassWord())) - || loginRequest.getPassword().equals(authAdmin.getPassWord()) - || (loginRequest.getPassword().equals(PasswordUtils.authAdminPwd(authAdmin.getPassWord()))) + || loginRequest.getPassword().equals(authAdmin.getPassWord()) || (loginRequest.getPassword().equals(PasswordUtils.authAdminPwd(authAdmin.getPassWord()))) ) { - + redisUtil.del(Constant.PASSWORD_ERROR_COUNT+authAdmin.getId()); } else { if (!PasswordUtils.authAdminPwd(loginRequest.getPassword()).equals(SecureUtil.sha256(authAdmin.getPassWord()))) { + redisUtil.set(Constant.PASSWORD_ERROR_COUNT+authAdmin.getId(), errorCount + 1,30*60); throw new JsonException(ResultEnum.DATA_NOT, "用户名或密码错误"); } } + if (authAdmin.getUserFlag() == 0) { throw new JsonException(ResultEnum.DATA_NOT, "该用户已被禁用!"); } diff --git a/src/main/java/com/glxp/api/controller/auth/SysUserController.java b/src/main/java/com/glxp/api/controller/auth/SysUserController.java index 1ffa4772c..23674781d 100644 --- a/src/main/java/com/glxp/api/controller/auth/SysUserController.java +++ b/src/main/java/com/glxp/api/controller/auth/SysUserController.java @@ -95,6 +95,7 @@ public class SysUserController extends BaseController { authAdminResponse.setDepts(depts); } authAdminResponse.setRoles(roles); + authAdminResponse.setPassWord(null); return authAdminResponse; }).collect(Collectors.toList()); diff --git a/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java b/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java index 7acca60ac..7ba3ad13b 100644 --- a/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java +++ b/src/main/java/com/glxp/api/controller/dev/DeviceInfoController.java @@ -137,6 +137,23 @@ public class DeviceInfoController extends BaseController { return ResultVOUtils.success(page); } + /** + * 查看当前用户所在科室设备详情 + * + * @param query + * @return + */ + @AuthRuleAnnotation("") + @PostMapping("/udi/device/info/detailByUser/one") + public BaseResponse detailByUserOne(@RequestBody DeviceInfoDetailQuery query) { + List list = deviceInfoService.detail(query); + PageInfo pageInfo = new PageInfo<>(list); + PageSimpleResponse page = new PageSimpleResponse(); + page.setTotal(pageInfo.getTotal()); + page.setList(pageInfo.getList()); + return ResultVOUtils.success(page); + } + /** * 查看当前科室设备详情 * diff --git a/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java b/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java index aa719956b..2eb4b2f21 100644 --- a/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java +++ b/src/main/java/com/glxp/api/controller/purchase/PurApplyController.java @@ -139,12 +139,12 @@ public class PurApplyController { @PostMapping("/purchase/apply/list") public BaseResponse list(@RequestBody PurApplyRequest purApplyRequest) { - if (purApplyRequest.getStatus() == null) { - purApplyRequest.setStatus(11); //查询未审核和草稿状态 - } + if (purApplyRequest.getIsUser() != null && purApplyRequest.getIsUser()) { AuthAdmin authAdmin = customerService.getUserBean(); purApplyRequest.setCreateUser(authAdmin.getId() + ""); //查询自己 + }else if (purApplyRequest.getStatus() == null) { + purApplyRequest.setStatus(11); //查询未审核和草稿状态 } Boolean sys_approval_flow = "1".equals(systemParamConfigService.selectValueByParamKey("sys_approval_flow")); diff --git a/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java b/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java index 6ee22923c..c5b862b0b 100644 --- a/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java +++ b/src/main/java/com/glxp/api/controller/thrsys/ThrDeptController.java @@ -1,5 +1,6 @@ package com.glxp.api.controller.thrsys; +import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; import com.github.pagehelper.PageInfo; @@ -146,7 +147,10 @@ public class ThrDeptController { if (StrUtil.isBlank(thirdSysFk)) { return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); } - return thrDeptService.downloadThirdWarehouse(thirdSysFk); + ThreadUtil.execAsync(() -> { + thrDeptService.downloadThirdWarehouse(thirdSysFk);; + }); + return ResultVOUtils.success("后台已开始下载,请稍后刷新查看!"); } diff --git a/src/main/java/com/glxp/api/http/ErpBasicClient.java b/src/main/java/com/glxp/api/http/ErpBasicClient.java index 4c8dd21e4..0594dd692 100644 --- a/src/main/java/com/glxp/api/http/ErpBasicClient.java +++ b/src/main/java/com/glxp/api/http/ErpBasicClient.java @@ -134,7 +134,6 @@ public class ErpBasicClient { BaseResponse> listBaseResponse = JSONObject.parseObject(response, new TypeReference>>() { }); - return listBaseResponse; } catch (Exception e) { log.error("获取第三方系统的仓库货位码异常", e); diff --git a/src/main/java/com/glxp/api/res/purchase/PurContractEntityResponse.java b/src/main/java/com/glxp/api/res/purchase/PurContractEntityResponse.java index 5b9619e2a..a8dd401cd 100644 --- a/src/main/java/com/glxp/api/res/purchase/PurContractEntityResponse.java +++ b/src/main/java/com/glxp/api/res/purchase/PurContractEntityResponse.java @@ -41,6 +41,12 @@ public class PurContractEntityResponse implements Serializable { @TableField(value = "fromCorp") private String fromCorp; + /** + * 往来单位/供应商 + */ + private String fromCorpName; + private String invCodeName; + /** * 合同签订日期 */ diff --git a/src/main/java/com/glxp/api/service/basic/impl/BasicDestinyRelService.java b/src/main/java/com/glxp/api/service/basic/impl/BasicDestinyRelService.java index b02a1b4dc..806a11db5 100644 --- a/src/main/java/com/glxp/api/service/basic/impl/BasicDestinyRelService.java +++ b/src/main/java/com/glxp/api/service/basic/impl/BasicDestinyRelService.java @@ -118,16 +118,47 @@ public class BasicDestinyRelService extends ServiceImpl> baseResponse = erpBasicClient.getBasicProject(request); +// if (baseResponse.getCode() == 20000) { +// List list = baseResponse.getData().getList(); +// if (CollUtil.isNotEmpty(list)) { +// list.forEach(item -> { +// BasicSkProjectEntity basicSkProjectEntity = new BasicSkProjectEntity(); +// BeanUtil.copyProperties(item, basicSkProjectEntity); +// basicSkProjectEntity.setType(2); +// Boolean b = basicSkProjectMapper.exists(new LambdaQueryWrapper().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode())); +// if (b) { +// basicSkProjectMapper.update(basicSkProjectEntity, new LambdaUpdateWrapper().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode())); +// } else { +// basicSkProjectEntity.setId(IdUtil.getSnowflakeNextId()); +// basicSkProjectMapper.insert(basicSkProjectEntity); +// } +// }); +// } +// if (list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) { +// page++; +// } else { +// break; +// } +// } else { +// return ResultVOUtils.error(500, "下载异常中断"); +// } +// } while (true) { request.setPage(page); BaseResponse> baseResponse = erpBasicClient.getBasicProject(request); + if (baseResponse.getCode() == 20000) { List list = baseResponse.getData().getList(); + if (CollUtil.isNotEmpty(list)) { list.forEach(item -> { BasicSkProjectEntity basicSkProjectEntity = new BasicSkProjectEntity(); BeanUtil.copyProperties(item, basicSkProjectEntity); basicSkProjectEntity.setType(2); + Boolean b = basicSkProjectMapper.exists(new LambdaQueryWrapper().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode())); if (b) { basicSkProjectMapper.update(basicSkProjectEntity, new LambdaUpdateWrapper().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode())); @@ -136,7 +167,15 @@ public class BasicDestinyRelService extends ServiceImpl 1000) { + log.error("List size exceeds 1000, stopping the loop." + list.size()); + break; + } } + + // 检查是否继续分页 if (list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) { page++; } else { diff --git a/src/main/java/com/glxp/api/service/inv/InvCountOrderDetailService.java b/src/main/java/com/glxp/api/service/inv/InvCountOrderDetailService.java index db117991a..cb5df7c5f 100644 --- a/src/main/java/com/glxp/api/service/inv/InvCountOrderDetailService.java +++ b/src/main/java/com/glxp/api/service/inv/InvCountOrderDetailService.java @@ -87,7 +87,12 @@ public class InvCountOrderDetailService extends ServiceImpl i @Override public BaseResponse downloadThirdWarehouse(String thirdSysFk) { int page = 1; - int limit = 100; + int limit = 1000; while (true) { UdiwmsWarehouseRequest udiwmsWarehouseRequest = new UdiwmsWarehouseRequest(); udiwmsWarehouseRequest.setThirdSys(thirdSysFk); @@ -135,42 +139,89 @@ public class ThrDeptServiceImpl extends ServiceImpl i BaseResponse> baseResponse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest); if (baseResponse.getCode() == 20000) { List responseList = baseResponse.getData().getList(); - List list = new ArrayList<>(); - List warehouseList = new ArrayList<>(); - for (UdiwmsWarehouseDetail response : responseList) { - ThrDeptEntity thrDeptEntity = new ThrDeptEntity(); - thrDeptEntity.setPid(0); - thrDeptEntity.setName(response.getName()); - thrDeptEntity.setCode(response.getCode()); + if (CollUtil.isNotEmpty(responseList)) { + AtomicInteger count = new AtomicInteger(); // 计数器 + responseList.forEach(item -> { + ThrDeptEntity thrDeptEntity = new ThrDeptEntity(); + ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity(); + BeanUtil.copyProperties(item, thrDeptEntity); + BeanUtil.copyProperties(item, thrInvWarehouseEntity); + + thrDeptEntity.setPid(0); + thrDeptEntity.setName(item.getName()); + thrDeptEntity.setCode(item.getCode()); thrDeptEntity.setThirdSysFk(thirdSysFk); thrDeptEntity.setAdvanceType(false); //默认是仓库 thrDeptEntity.setStatus(1);//默认启用 thrDeptEntity.setUpdateTime(new Date()); thrDeptEntity.setId(IdUtil.getSnowflake(6, 1).nextId()); - list.add(thrDeptEntity); - ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity(); - thrInvWarehouseEntity.setCode(response.getCode()); - thrInvWarehouseEntity.setName(response.getName()); - thrInvWarehouseEntity.setRemark(response.getRemark()); + + thrInvWarehouseEntity.setCode(item.getCode()); + thrInvWarehouseEntity.setName(item.getName()); + thrInvWarehouseEntity.setRemark(item.getRemark()); thrInvWarehouseEntity.setThirdSysFk(thirdSysFk); - thrInvWarehouseEntity.setParentId(response.getCode()); + thrInvWarehouseEntity.setParentId(item.getCode()); thrInvWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + ""); thrInvWarehouseEntity.setUpdateTime(new Date()); - warehouseList.add(thrInvWarehouseEntity); - + boolean b = thrDeptDao.exists(new LambdaQueryWrapper().eq(ThrDeptEntity::getCode, thrDeptEntity.getCode())); + if (b) { + thrDeptDao.update(thrDeptEntity, new LambdaUpdateWrapper().eq(ThrDeptEntity::getCode, thrDeptEntity.getCode())); + } else { + thrDeptDao.insert(thrDeptEntity); + } + boolean b1 = thrInvWarehouseDao.exists(new LambdaQueryWrapper().eq(ThrInvWarehouseEntity::getCode, thrInvWarehouseEntity.getCode())); + if (b1) { + thrInvWarehouseDao.update(thrInvWarehouseEntity, new LambdaUpdateWrapper().eq(ThrInvWarehouseEntity::getCode, thrInvWarehouseEntity.getCode())); + } else { + thrInvWarehouseDao.insert(thrInvWarehouseEntity); + } + + }); } - //插入数据 - thrDeptDao.insertThrDeptList(list); - thrInvWarehouseDao.insertThrInvWarehouses(warehouseList); - if (list.size() >= limit) { + if (responseList.size() >= limit) { page++; } else { break; } +// List list = new ArrayList<>(); +// List warehouseList = new ArrayList<>(); +// for (UdiwmsWarehouseDetail response : responseList) { +// ThrDeptEntity thrDeptEntity = new ThrDeptEntity(); +// thrDeptEntity.setPid(0); +// thrDeptEntity.setName(response.getName()); +// thrDeptEntity.setCode(response.getCode()); +// thrDeptEntity.setThirdSysFk(thirdSysFk); +// thrDeptEntity.setAdvanceType(false); //默认是仓库 +// thrDeptEntity.setStatus(1);//默认启用 +// thrDeptEntity.setUpdateTime(new Date()); +// thrDeptEntity.setId(IdUtil.getSnowflake(6, 1).nextId()); +// list.add(thrDeptEntity); +// +// ThrInvWarehouseEntity thrInvWarehouseEntity = new ThrInvWarehouseEntity(); +// thrInvWarehouseEntity.setCode(response.getCode()); +// thrInvWarehouseEntity.setName(response.getName()); +// thrInvWarehouseEntity.setRemark(response.getRemark()); +// thrInvWarehouseEntity.setThirdSysFk(thirdSysFk); +// thrInvWarehouseEntity.setParentId(response.getCode()); +// thrInvWarehouseEntity.setId(IdUtil.getSnowflake(6, 1).nextId() + ""); +// thrInvWarehouseEntity.setUpdateTime(new Date()); +// warehouseList.add(thrInvWarehouseEntity); +// +// +// } +// //插入数据 +// thrDeptDao.insertThrDeptList(list); +// thrInvWarehouseDao.insertThrInvWarehouses(warehouseList); +// if (list.size() >= limit) { +// page++; +// } else { +// break; +// } + } else { - return baseResponse; + return ResultVOUtils.error(500, "下载异常中断"); } } diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvWarehouseServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvWarehouseServiceImpl.java index eecde8a5d..4de022dab 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvWarehouseServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrInvWarehouseServiceImpl.java @@ -164,7 +164,10 @@ public class ThrInvWarehouseServiceImpl extends ServiceImpl 100) { + log.error("downloadThrInv List size exceeds 1000, stopping the loop." + list.size()); + break; + } //请求下一页数据 if (list.size() >= limit) { page++; diff --git a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java index 66f56f781..4a71cddf5 100644 --- a/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java +++ b/src/main/java/com/glxp/api/service/thrsys/impl/ThrProductsServiceImpl.java @@ -277,7 +277,9 @@ public class ThrProductsServiceImpl extends ServiceImpl 200) { + log.error("List size exceeds 1000, stopping the loop." + list.size()); + break; + } //total = -666 表示出错,-555表示数据已经被过滤,可以进行下一页下载 if ((list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) || IntUtil.value(baseResponse.getData().getTotal()) == -555) { page++; diff --git a/src/main/resources/mybatis/mapper/purchase/PurContractMapper.xml b/src/main/resources/mybatis/mapper/purchase/PurContractMapper.xml index 789e1fdc7..4e5758226 100644 --- a/src/main/resources/mybatis/mapper/purchase/PurContractMapper.xml +++ b/src/main/resources/mybatis/mapper/purchase/PurContractMapper.xml @@ -94,8 +94,10 @@ pc.id, pc.code, pc.`name`, pc.fromCorp, pc.contractDate, pc.invCode, pc.`type`, pc.payType, pc.startDate, pc.endDate, pc.amount, pc.payAmount, pc.payDate, pc.invoiceDate, pc.planOrderIdFk, pc.orderIdFk, pc.`createUser`, pc.updateUser, pc.createTime, pc.updateTime, pc.remark,pc.approvalFlowId,pc.isGenerateOrder,IFNULL(pc.status,0) as status, - saf.status as flowStatus, saf.nextNodeName as nextNodeName , saf.nextApprovalNodeType as nextApprovalNodeType + saf.status as flowStatus, saf.nextNodeName as nextNodeName , saf.nextApprovalNodeType as nextApprovalNodeType,bc.name as fromCorpName,aw.name AS invCodeName from pur_contract pc + left join basic_corp bc on pc.fromCorp = bc.erpId + left join auth_warehouse aw on pc.invCode = aw.code left join sys_approval_flow saf ON pc.approvalFlowId = saf.id pc.code is not null diff --git a/src/main/resources/schemas/schema_v2.4.sql b/src/main/resources/schemas/schema_v2.4.sql index 5fa8abdf1..4ae32910f 100644 --- a/src/main/resources/schemas/schema_v2.4.sql +++ b/src/main/resources/schemas/schema_v2.4.sql @@ -2583,7 +2583,7 @@ CREATE TABLE IF NOT EXISTS `pur_contract` `invCode` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '当前仓库', `status` int(0) NULL DEFAULT NULL COMMENT '合同状态', `type` int(0) NULL DEFAULT NULL COMMENT '合同类型', - `payType` int(0) NULL DEFAULT NULL COMMENT '付款方式', + `payType` varchar(60) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '付款方式', `startDate` datetime(0) NULL DEFAULT NULL COMMENT '开始时间', `endDate` datetime(0) NULL DEFAULT NULL COMMENT '截止时间', `amount` decimal(10, 3) NULL DEFAULT NULL COMMENT '合同金额',