Merge branch 'cc_20241125_fix_addoperationLog' into 'master'

Cc 20241125 fix addoperation log

See merge request hangzhou/java/custom_zxjp!31
This commit is contained in:
王晓鹏
2024-11-25 11:05:26 +00:00
2 changed files with 29 additions and 2 deletions

View File

@@ -29,7 +29,6 @@ public class OperationLogDAO {
if (Objects.isNull(operationLogDO)) { if (Objects.isNull(operationLogDO)) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
} }
operationLogDO.setCreateTime(new Date());
operationLogMapper.insertSelective(operationLogDO); operationLogMapper.insertSelective(operationLogDO);
return operationLogDO.getId(); return operationLogDO.getId();
} }

View File

@@ -13,6 +13,7 @@ import com.cool.store.enums.*;
import com.cool.store.enums.point.ShopSubStageStatusEnum; import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.response.AuditInfoResponse; import com.cool.store.response.AuditInfoResponse;
import com.cool.store.service.OperationLogService; import com.cool.store.service.OperationLogService;
import com.cool.store.utils.poi.StringUtils;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -177,16 +178,43 @@ public class OperationLogServiceImpl implements OperationLogService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean batchUpdateProcessed(List<OperationLogDO> operationLogs, Long audit, String userId, String reason) { public Boolean batchUpdateProcessed(List<OperationLogDO> operationLogs, Long audit, String userId, String reason) {
List<OperationLogDO> operationLogList = new ArrayList<>(); List<OperationLogDO> operationLogList = new ArrayList<>();
Boolean flag = Boolean.FALSE;
Date createTime = new Date();
Date updateTime = new Date();
for (OperationLogDO operationLogDO : operationLogs) { for (OperationLogDO operationLogDO : operationLogs) {
operationLogDO.setUpdateTime(new Date()); operationLogDO.setUpdateTime(updateTime);
operationLogDO.setUpdateUserId(userId); operationLogDO.setUpdateUserId(userId);
operationLogDO.setStatus(OperationStatusEnum.PROCESSED.getCode()); operationLogDO.setStatus(OperationStatusEnum.PROCESSED.getCode());
if (operationLogDO.getOperator().equals(userId)) { if (operationLogDO.getOperator().equals(userId)) {
operationLogDO.setAuditResultId(audit); operationLogDO.setAuditResultId(audit);
flag = Boolean.TRUE;
}
if (operationLogDO.getType().equals(OperationTypeEnum.OPERATION_TYPE_1.getCode())) {
createTime = operationLogDO.getCreateTime();
} }
operationLogDO.setRemarks(reason); operationLogDO.setRemarks(reason);
operationLogList.add(operationLogDO); operationLogList.add(operationLogDO);
} }
if (!flag){
OperationLogDO operationLogDO1 = operationLogList.get(0);
OperationLogDO operationLogDO = new OperationLogDO();
operationLogDO.setOperator(userId);
operationLogDO.setAuditResultId(audit);
operationLogDO.setRemarks(reason);
operationLogDO.setShopId(operationLogDO1.getShopId());
operationLogDO.setShopSubStage(operationLogDO1.getShopSubStage());
operationLogDO.setShopSubStageStatus(operationLogDO1.getShopSubStageStatus());
operationLogDO.setStatus(OperationStatusEnum.PROCESSED.getCode());
operationLogDO.setType(OperationTypeEnum.OPERATION_TYPE_1.getCode());
String userName = enterpriseUserDAO.getUserName(userId);
if (StringUtils.isNotBlank(userName)) {
operationLogDO.setOperatorName(userName);
}
operationLogDO.setCreateTime(createTime);
operationLogDO.setUpdateTime(updateTime);
operationLogDO.setCreateUserId(userId);
operationLogDAO.addOperationLog(operationLogDO);
}
return operationLogDAO.batchUpdateByPrimaryKeySelective(operationLogList); return operationLogDAO.batchUpdateByPrimaryKeySelective(operationLogList);
} }