Merge branch 'dev_fifo' into lh_dev_fifo

lh_dev_fifo
wangwei 3 months ago
commit 82057f4839

@ -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";
}

@ -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, "该用户已被禁用!");
}

@ -95,6 +95,7 @@ public class SysUserController extends BaseController {
authAdminResponse.setDepts(depts);
}
authAdminResponse.setRoles(roles);
authAdminResponse.setPassWord(null);
return authAdminResponse;
}).collect(Collectors.toList());

@ -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<DeviceInfoVo> 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);
}
/**
*
*

@ -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"));

@ -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("后台已开始下载,请稍后刷新查看!");
}

@ -134,7 +134,6 @@ public class ErpBasicClient {
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> listBaseResponse =
JSONObject.parseObject(response, new TypeReference<BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>>>() {
});
return listBaseResponse;
} catch (Exception e) {
log.error("获取第三方系统的仓库货位码异常", e);

@ -41,6 +41,12 @@ public class PurContractEntityResponse implements Serializable {
@TableField(value = "fromCorp")
private String fromCorp;
/**
* /
*/
private String fromCorpName;
private String invCodeName;
/**
*
*/

@ -118,16 +118,47 @@ public class BasicDestinyRelService extends ServiceImpl<BasicDestinyRelMapper, B
int limit = 1000;
request.setThirdSys("thirdId");
request.setLimit(limit);
// while (true) {
// request.setPage(page);
// BaseResponse<PageSimpleResponse<BasicSkProjectResponse>> baseResponse = erpBasicClient.getBasicProject(request);
// if (baseResponse.getCode() == 20000) {
// List<BasicSkProjectResponse> 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<BasicSkProjectEntity>().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode()));
// if (b) {
// basicSkProjectMapper.update(basicSkProjectEntity, new LambdaUpdateWrapper<BasicSkProjectEntity>().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<PageSimpleResponse<BasicSkProjectResponse>> baseResponse = erpBasicClient.getBasicProject(request);
if (baseResponse.getCode() == 20000) {
List<BasicSkProjectResponse> 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<BasicSkProjectEntity>().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode()));
if (b) {
basicSkProjectMapper.update(basicSkProjectEntity, new LambdaUpdateWrapper<BasicSkProjectEntity>().eq(BasicSkProjectEntity::getCode, basicSkProjectEntity.getCode()));
@ -136,7 +167,15 @@ public class BasicDestinyRelService extends ServiceImpl<BasicDestinyRelMapper, B
basicSkProjectMapper.insert(basicSkProjectEntity);
}
});
// 检查 list.size() 是否大于 1000
if (list.size() > 1000) {
log.error("List size exceeds 1000, stopping the loop." + list.size());
break;
}
}
// 检查是否继续分页
if (list.size() >= limit && !baseResponse.getData().getTotal().equals(-666)) {
page++;
} else {

@ -87,7 +87,12 @@ public class InvCountOrderDetailService extends ServiceImpl<InvCountOrderDetailM
for (InvCountOrderDetailEntity invCountOrderDetailEntity : countOrderDetailList) {
invCountOrderDetailEntity.setOrderIdFk(orderId);
invCountOrderDetailEntity.setId(null);
Integer countNum = invCountOrderDetailEntity.getCountNum();
if (countNum == null) {
invCountOrderDetailEntity.setCountNum(invCountOrderDetailEntity.getInvNum());
}else {
invCountOrderDetailEntity.setCountNum(countNum);
}
}
invCountOrderDetailDao.insertBatch(countOrderDetailList);
}

@ -1,7 +1,11 @@
package com.glxp.api.service.thrsys.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageHelper;
import com.glxp.api.common.res.BaseResponse;
@ -20,10 +24,10 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
@Service
@Transactional(rollbackFor = Exception.class)
@ -126,7 +130,7 @@ public class ThrDeptServiceImpl extends ServiceImpl<ThrDeptDao, ThrDeptEntity> 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<ThrDeptDao, ThrDeptEntity> i
BaseResponse<PageSimpleResponse<UdiwmsWarehouseDetail>> baseResponse = erpBasicClient.getWarehouse(udiwmsWarehouseRequest);
if (baseResponse.getCode() == 20000) {
List<UdiwmsWarehouseDetail> responseList = baseResponse.getData().getList();
List<ThrDeptEntity> list = new ArrayList<>();
List<ThrInvWarehouseEntity> warehouseList = new ArrayList<>();
for (UdiwmsWarehouseDetail response : responseList) {
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(response.getName());
thrDeptEntity.setCode(response.getCode());
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<ThrDeptEntity>().eq(ThrDeptEntity::getCode, thrDeptEntity.getCode()));
if (b) {
thrDeptDao.update(thrDeptEntity, new LambdaUpdateWrapper<ThrDeptEntity>().eq(ThrDeptEntity::getCode, thrDeptEntity.getCode()));
} else {
thrDeptDao.insert(thrDeptEntity);
}
boolean b1 = thrInvWarehouseDao.exists(new LambdaQueryWrapper<ThrInvWarehouseEntity>().eq(ThrInvWarehouseEntity::getCode, thrInvWarehouseEntity.getCode()));
if (b1) {
thrInvWarehouseDao.update(thrInvWarehouseEntity, new LambdaUpdateWrapper<ThrInvWarehouseEntity>().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<ThrDeptEntity> list = new ArrayList<>();
// List<ThrInvWarehouseEntity> 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, "下载异常中断");
}
}

@ -164,7 +164,10 @@ public class ThrInvWarehouseServiceImpl extends ServiceImpl<ThrInvWarehouseDao,
}
}
});
if (list.size() > 100) {
log.error("downloadThrInv List size exceeds 1000, stopping the loop." + list.size());
break;
}
//请求下一页数据
if (list.size() >= limit) {
page++;

@ -277,8 +277,10 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
thrProductsEntity.setCreateTime(new Date());
thrProductsEntity.setUpdateTime(new Date());
if (StrUtil.isEmpty(item.getSpec())) {
if (StrUtil.isNotEmpty(item.getStandard())){
thrProductsEntity.setSpec(item.getStandard());
}
}
thrProductsEntity.setId(IdUtil.getSnowflakeNextId());
thrProductsEntity.setThirdSysFk(filterThrProductsRequest.getThirdSys());
thrProductsDao.insertThrProducts(thrProductsEntity);
@ -294,6 +296,11 @@ public class ThrProductsServiceImpl extends ServiceImpl<ThrProductsDao, ThrProdu
}
}
});
// 检查 list.size() 是否大于 1000
if (list.size() > 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++;

@ -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
<where>
pc.code is not null

@ -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 '合同金额',

Loading…
Cancel
Save